(self["webpackChunk_N_E"] = self["webpackChunk_N_E"] || []).push([[888],{ /***/ 2258: /***/ (function(module) { "use strict"; var token = '%[a-f0-9]{2}'; var singleMatcher = new RegExp('(' + token + ')|([^%]+?)', 'gi'); var multiMatcher = new RegExp('(' + token + ')+', 'gi'); function decodeComponents(components, split) { try { // Try to decode the entire string first return [decodeURIComponent(components.join(''))]; } catch (err) { // Do nothing } if (components.length === 1) { return components; } split = split || 1; // Split the array in 2 parts var left = components.slice(0, split); var right = components.slice(split); return Array.prototype.concat.call([], decodeComponents(left), decodeComponents(right)); } function decode(input) { try { return decodeURIComponent(input); } catch (err) { var tokens = input.match(singleMatcher) || []; for (var i = 1; i < tokens.length; i++) { input = decodeComponents(tokens, i).join(''); tokens = input.match(singleMatcher) || []; } return input; } } function customDecodeURIComponent(input) { // Keep track of all the replacements and prefill the map with the `BOM` var replaceMap = { '%FE%FF': '\uFFFD\uFFFD', '%FF%FE': '\uFFFD\uFFFD' }; var match = multiMatcher.exec(input); while (match) { try { // Decode as big chunks as possible replaceMap[match[0]] = decodeURIComponent(match[0]); } catch (err) { var result = decode(match[0]); if (result !== match[0]) { replaceMap[match[0]] = result; } } match = multiMatcher.exec(input); } // Add `%C2` at the end of the map to make sure it does not replace the combinator before everything else replaceMap['%C2'] = '\uFFFD'; var entries = Object.keys(replaceMap); for (var i = 0; i < entries.length; i++) { // Replace all decoded components var key = entries[i]; input = input.replace(new RegExp(key, 'g'), replaceMap[key]); } return input; } module.exports = function (encodedURI) { if (typeof encodedURI !== 'string') { throw new TypeError('Expected `encodedURI` to be of type `string`, got `' + typeof encodedURI + '`'); } try { encodedURI = encodedURI.replace(/\+/g, ' '); // Try the built in decoder first return decodeURIComponent(encodedURI); } catch (err) { // Fallback to a more advanced decoder return customDecodeURIComponent(encodedURI); } }; /***/ }), /***/ 1583: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; const strictUriEncode = __webpack_require__(70610); const decodeComponent = __webpack_require__(2258); const splitOnFirst = __webpack_require__(80500); const filterObject = __webpack_require__(92806); const isNullOrUndefined = value => value === null || value === undefined; const encodeFragmentIdentifier = Symbol('encodeFragmentIdentifier'); function encoderForArrayFormat(options) { switch (options.arrayFormat) { case 'index': return key => (result, value) => { const index = result.length; if ( value === undefined || (options.skipNull && value === null) || (options.skipEmptyString && value === '') ) { return result; } if (value === null) { return [...result, [encode(key, options), '[', index, ']'].join('')]; } return [ ...result, [encode(key, options), '[', encode(index, options), ']=', encode(value, options)].join('') ]; }; case 'bracket': return key => (result, value) => { if ( value === undefined || (options.skipNull && value === null) || (options.skipEmptyString && value === '') ) { return result; } if (value === null) { return [...result, [encode(key, options), '[]'].join('')]; } return [...result, [encode(key, options), '[]=', encode(value, options)].join('')]; }; case 'colon-list-separator': return key => (result, value) => { if ( value === undefined || (options.skipNull && value === null) || (options.skipEmptyString && value === '') ) { return result; } if (value === null) { return [...result, [encode(key, options), ':list='].join('')]; } return [...result, [encode(key, options), ':list=', encode(value, options)].join('')]; }; case 'comma': case 'separator': case 'bracket-separator': { const keyValueSep = options.arrayFormat === 'bracket-separator' ? '[]=' : '='; return key => (result, value) => { if ( value === undefined || (options.skipNull && value === null) || (options.skipEmptyString && value === '') ) { return result; } // Translate null to an empty string so that it doesn't serialize as 'null' value = value === null ? '' : value; if (result.length === 0) { return [[encode(key, options), keyValueSep, encode(value, options)].join('')]; } return [[result, encode(value, options)].join(options.arrayFormatSeparator)]; }; } default: return key => (result, value) => { if ( value === undefined || (options.skipNull && value === null) || (options.skipEmptyString && value === '') ) { return result; } if (value === null) { return [...result, encode(key, options)]; } return [...result, [encode(key, options), '=', encode(value, options)].join('')]; }; } } function parserForArrayFormat(options) { let result; switch (options.arrayFormat) { case 'index': return (key, value, accumulator) => { result = /\[(\d*)\]$/.exec(key); key = key.replace(/\[\d*\]$/, ''); if (!result) { accumulator[key] = value; return; } if (accumulator[key] === undefined) { accumulator[key] = {}; } accumulator[key][result[1]] = value; }; case 'bracket': return (key, value, accumulator) => { result = /(\[\])$/.exec(key); key = key.replace(/\[\]$/, ''); if (!result) { accumulator[key] = value; return; } if (accumulator[key] === undefined) { accumulator[key] = [value]; return; } accumulator[key] = [].concat(accumulator[key], value); }; case 'colon-list-separator': return (key, value, accumulator) => { result = /(:list)$/.exec(key); key = key.replace(/:list$/, ''); if (!result) { accumulator[key] = value; return; } if (accumulator[key] === undefined) { accumulator[key] = [value]; return; } accumulator[key] = [].concat(accumulator[key], value); }; case 'comma': case 'separator': return (key, value, accumulator) => { const isArray = typeof value === 'string' && value.includes(options.arrayFormatSeparator); const isEncodedArray = (typeof value === 'string' && !isArray && decode(value, options).includes(options.arrayFormatSeparator)); value = isEncodedArray ? decode(value, options) : value; const newValue = isArray || isEncodedArray ? value.split(options.arrayFormatSeparator).map(item => decode(item, options)) : value === null ? value : decode(value, options); accumulator[key] = newValue; }; case 'bracket-separator': return (key, value, accumulator) => { const isArray = /(\[\])$/.test(key); key = key.replace(/\[\]$/, ''); if (!isArray) { accumulator[key] = value ? decode(value, options) : value; return; } const arrayValue = value === null ? [] : value.split(options.arrayFormatSeparator).map(item => decode(item, options)); if (accumulator[key] === undefined) { accumulator[key] = arrayValue; return; } accumulator[key] = [].concat(accumulator[key], arrayValue); }; default: return (key, value, accumulator) => { if (accumulator[key] === undefined) { accumulator[key] = value; return; } accumulator[key] = [].concat(accumulator[key], value); }; } } function validateArrayFormatSeparator(value) { if (typeof value !== 'string' || value.length !== 1) { throw new TypeError('arrayFormatSeparator must be single character string'); } } function encode(value, options) { if (options.encode) { return options.strict ? strictUriEncode(value) : encodeURIComponent(value); } return value; } function decode(value, options) { if (options.decode) { return decodeComponent(value); } return value; } function keysSorter(input) { if (Array.isArray(input)) { return input.sort(); } if (typeof input === 'object') { return keysSorter(Object.keys(input)) .sort((a, b) => Number(a) - Number(b)) .map(key => input[key]); } return input; } function removeHash(input) { const hashStart = input.indexOf('#'); if (hashStart !== -1) { input = input.slice(0, hashStart); } return input; } function getHash(url) { let hash = ''; const hashStart = url.indexOf('#'); if (hashStart !== -1) { hash = url.slice(hashStart); } return hash; } function extract(input) { input = removeHash(input); const queryStart = input.indexOf('?'); if (queryStart === -1) { return ''; } return input.slice(queryStart + 1); } function parseValue(value, options) { if (options.parseNumbers && !Number.isNaN(Number(value)) && (typeof value === 'string' && value.trim() !== '')) { value = Number(value); } else if (options.parseBooleans && value !== null && (value.toLowerCase() === 'true' || value.toLowerCase() === 'false')) { value = value.toLowerCase() === 'true'; } return value; } function parse(query, options) { options = Object.assign({ decode: true, sort: true, arrayFormat: 'none', arrayFormatSeparator: ',', parseNumbers: false, parseBooleans: false }, options); validateArrayFormatSeparator(options.arrayFormatSeparator); const formatter = parserForArrayFormat(options); // Create an object with no prototype const ret = Object.create(null); if (typeof query !== 'string') { return ret; } query = query.trim().replace(/^[?#&]/, ''); if (!query) { return ret; } for (const param of query.split('&')) { if (param === '') { continue; } let [key, value] = splitOnFirst(options.decode ? param.replace(/\+/g, ' ') : param, '='); // Missing `=` should be `null`: // http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters value = value === undefined ? null : ['comma', 'separator', 'bracket-separator'].includes(options.arrayFormat) ? value : decode(value, options); formatter(decode(key, options), value, ret); } for (const key of Object.keys(ret)) { const value = ret[key]; if (typeof value === 'object' && value !== null) { for (const k of Object.keys(value)) { value[k] = parseValue(value[k], options); } } else { ret[key] = parseValue(value, options); } } if (options.sort === false) { return ret; } return (options.sort === true ? Object.keys(ret).sort() : Object.keys(ret).sort(options.sort)).reduce((result, key) => { const value = ret[key]; if (Boolean(value) && typeof value === 'object' && !Array.isArray(value)) { // Sort object keys, not values result[key] = keysSorter(value); } else { result[key] = value; } return result; }, Object.create(null)); } exports.extract = extract; exports.parse = parse; exports.stringify = (object, options) => { if (!object) { return ''; } options = Object.assign({ encode: true, strict: true, arrayFormat: 'none', arrayFormatSeparator: ',' }, options); validateArrayFormatSeparator(options.arrayFormatSeparator); const shouldFilter = key => ( (options.skipNull && isNullOrUndefined(object[key])) || (options.skipEmptyString && object[key] === '') ); const formatter = encoderForArrayFormat(options); const objectCopy = {}; for (const key of Object.keys(object)) { if (!shouldFilter(key)) { objectCopy[key] = object[key]; } } const keys = Object.keys(objectCopy); if (options.sort !== false) { keys.sort(options.sort); } return keys.map(key => { const value = object[key]; if (value === undefined) { return ''; } if (value === null) { return encode(key, options); } if (Array.isArray(value)) { if (value.length === 0 && options.arrayFormat === 'bracket-separator') { return encode(key, options) + '[]'; } return value .reduce(formatter(key), []) .join('&'); } return encode(key, options) + '=' + encode(value, options); }).filter(x => x.length > 0).join('&'); }; exports.parseUrl = (url, options) => { options = Object.assign({ decode: true }, options); const [url_, hash] = splitOnFirst(url, '#'); return Object.assign( { url: url_.split('?')[0] || '', query: parse(extract(url), options) }, options && options.parseFragmentIdentifier && hash ? {fragmentIdentifier: decode(hash, options)} : {} ); }; exports.stringifyUrl = (object, options) => { options = Object.assign({ encode: true, strict: true, [encodeFragmentIdentifier]: true }, options); const url = removeHash(object.url).split('?')[0] || ''; const queryFromUrl = exports.extract(object.url); const parsedQueryFromUrl = exports.parse(queryFromUrl, {sort: false}); const query = Object.assign(parsedQueryFromUrl, object.query); let queryString = exports.stringify(query, options); if (queryString) { queryString = `?${queryString}`; } let hash = getHash(object.url); if (object.fragmentIdentifier) { hash = `#${options[encodeFragmentIdentifier] ? encode(object.fragmentIdentifier, options) : object.fragmentIdentifier}`; } return `${url}${queryString}${hash}`; }; exports.pick = (input, filter, options) => { options = Object.assign({ parseFragmentIdentifier: true, [encodeFragmentIdentifier]: false }, options); const {url, query, fragmentIdentifier} = exports.parseUrl(input, options); return exports.stringifyUrl({ url, query: filterObject(query, filter), fragmentIdentifier }, options); }; exports.exclude = (input, filter, options) => { const exclusionFilter = Array.isArray(filter) ? key => !filter.includes(key) : (key, value) => !filter(key, value); return exports.pick(input, exclusionFilter, options); }; /***/ }), /***/ 95851: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "i": function() { return /* binding */ version; } /* harmony export */ }); const version = "abi/5.6.4"; //# sourceMappingURL=_version.js.map /***/ }), /***/ 84243: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { "R": function() { return /* binding */ AbiCoder; }, "$": function() { return /* binding */ defaultAbiCoder; } }); // EXTERNAL MODULE: ./node_modules/@ethersproject/bytes/lib.esm/index.js + 1 modules var lib_esm = __webpack_require__(16441); // EXTERNAL MODULE: ./node_modules/@ethersproject/properties/lib.esm/index.js + 1 modules var properties_lib_esm = __webpack_require__(6881); // EXTERNAL MODULE: ./node_modules/@ethersproject/logger/lib.esm/index.js + 1 modules var logger_lib_esm = __webpack_require__(1581); // EXTERNAL MODULE: ./node_modules/@ethersproject/abi/lib.esm/_version.js var _version = __webpack_require__(95851); // EXTERNAL MODULE: ./node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js var abstract_coder = __webpack_require__(61184); // EXTERNAL MODULE: ./node_modules/@ethersproject/address/lib.esm/index.js + 1 modules var address_lib_esm = __webpack_require__(19485); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/abi/lib.esm/coders/address.js class AddressCoder extends abstract_coder/* Coder */.XI { constructor(localName) { super("address", "address", localName, false); } defaultValue() { return "0x0000000000000000000000000000000000000000"; } encode(writer, value) { try { value = (0,address_lib_esm.getAddress)(value); } catch (error) { this._throwError(error.message, value); } return writer.writeValue(value); } decode(reader) { return (0,address_lib_esm.getAddress)((0,lib_esm.hexZeroPad)(reader.readValue().toHexString(), 20)); } } //# sourceMappingURL=address.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/abi/lib.esm/coders/anonymous.js // Clones the functionality of an existing Coder, but without a localName class AnonymousCoder extends abstract_coder/* Coder */.XI { constructor(coder) { super(coder.name, coder.type, undefined, coder.dynamic); this.coder = coder; } defaultValue() { return this.coder.defaultValue(); } encode(writer, value) { return this.coder.encode(writer, value); } decode(reader) { return this.coder.decode(reader); } } //# sourceMappingURL=anonymous.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/abi/lib.esm/coders/array.js const logger = new logger_lib_esm.Logger(_version/* version */.i); function pack(writer, coders, values) { let arrayValues = null; if (Array.isArray(values)) { arrayValues = values; } else if (values && typeof (values) === "object") { let unique = {}; arrayValues = coders.map((coder) => { const name = coder.localName; if (!name) { logger.throwError("cannot encode object for signature with missing names", logger_lib_esm.Logger.errors.INVALID_ARGUMENT, { argument: "values", coder: coder, value: values }); } if (unique[name]) { logger.throwError("cannot encode object for signature with duplicate names", logger_lib_esm.Logger.errors.INVALID_ARGUMENT, { argument: "values", coder: coder, value: values }); } unique[name] = true; return values[name]; }); } else { logger.throwArgumentError("invalid tuple value", "tuple", values); } if (coders.length !== arrayValues.length) { logger.throwArgumentError("types/value length mismatch", "tuple", values); } let staticWriter = new abstract_coder/* Writer */.QV(writer.wordSize); let dynamicWriter = new abstract_coder/* Writer */.QV(writer.wordSize); let updateFuncs = []; coders.forEach((coder, index) => { let value = arrayValues[index]; if (coder.dynamic) { // Get current dynamic offset (for the future pointer) let dynamicOffset = dynamicWriter.length; // Encode the dynamic value into the dynamicWriter coder.encode(dynamicWriter, value); // Prepare to populate the correct offset once we are done let updateFunc = staticWriter.writeUpdatableValue(); updateFuncs.push((baseOffset) => { updateFunc(baseOffset + dynamicOffset); }); } else { coder.encode(staticWriter, value); } }); // Backfill all the dynamic offsets, now that we know the static length updateFuncs.forEach((func) => { func(staticWriter.length); }); let length = writer.appendWriter(staticWriter); length += writer.appendWriter(dynamicWriter); return length; } function unpack(reader, coders) { let values = []; // A reader anchored to this base let baseReader = reader.subReader(0); coders.forEach((coder) => { let value = null; if (coder.dynamic) { let offset = reader.readValue(); let offsetReader = baseReader.subReader(offset.toNumber()); try { value = coder.decode(offsetReader); } catch (error) { // Cannot recover from this if (error.code === logger_lib_esm.Logger.errors.BUFFER_OVERRUN) { throw error; } value = error; value.baseType = coder.name; value.name = coder.localName; value.type = coder.type; } } else { try { value = coder.decode(reader); } catch (error) { // Cannot recover from this if (error.code === logger_lib_esm.Logger.errors.BUFFER_OVERRUN) { throw error; } value = error; value.baseType = coder.name; value.name = coder.localName; value.type = coder.type; } } if (value != undefined) { values.push(value); } }); // We only output named properties for uniquely named coders const uniqueNames = coders.reduce((accum, coder) => { const name = coder.localName; if (name) { if (!accum[name]) { accum[name] = 0; } accum[name]++; } return accum; }, {}); // Add any named parameters (i.e. tuples) coders.forEach((coder, index) => { let name = coder.localName; if (!name || uniqueNames[name] !== 1) { return; } if (name === "length") { name = "_length"; } if (values[name] != null) { return; } const value = values[index]; if (value instanceof Error) { Object.defineProperty(values, name, { enumerable: true, get: () => { throw value; } }); } else { values[name] = value; } }); for (let i = 0; i < values.length; i++) { const value = values[i]; if (value instanceof Error) { Object.defineProperty(values, i, { enumerable: true, get: () => { throw value; } }); } } return Object.freeze(values); } class ArrayCoder extends abstract_coder/* Coder */.XI { constructor(coder, length, localName) { const type = (coder.type + "[" + (length >= 0 ? length : "") + "]"); const dynamic = (length === -1 || coder.dynamic); super("array", type, localName, dynamic); this.coder = coder; this.length = length; } defaultValue() { // Verifies the child coder is valid (even if the array is dynamic or 0-length) const defaultChild = this.coder.defaultValue(); const result = []; for (let i = 0; i < this.length; i++) { result.push(defaultChild); } return result; } encode(writer, value) { if (!Array.isArray(value)) { this._throwError("expected array value", value); } let count = this.length; if (count === -1) { count = value.length; writer.writeValue(value.length); } logger.checkArgumentCount(value.length, count, "coder array" + (this.localName ? (" " + this.localName) : "")); let coders = []; for (let i = 0; i < value.length; i++) { coders.push(this.coder); } return pack(writer, coders, value); } decode(reader) { let count = this.length; if (count === -1) { count = reader.readValue().toNumber(); // Check that there is *roughly* enough data to ensure // stray random data is not being read as a length. Each // slot requires at least 32 bytes for their value (or 32 // bytes as a link to the data). This could use a much // tighter bound, but we are erroring on the side of safety. if (count * 32 > reader._data.length) { logger.throwError("insufficient data length", logger_lib_esm.Logger.errors.BUFFER_OVERRUN, { length: reader._data.length, count: count }); } } let coders = []; for (let i = 0; i < count; i++) { coders.push(new AnonymousCoder(this.coder)); } return reader.coerce(this.name, unpack(reader, coders)); } } //# sourceMappingURL=array.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/abi/lib.esm/coders/boolean.js class BooleanCoder extends abstract_coder/* Coder */.XI { constructor(localName) { super("bool", "bool", localName, false); } defaultValue() { return false; } encode(writer, value) { return writer.writeValue(value ? 1 : 0); } decode(reader) { return reader.coerce(this.type, !reader.readValue().isZero()); } } //# sourceMappingURL=boolean.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/abi/lib.esm/coders/bytes.js class DynamicBytesCoder extends abstract_coder/* Coder */.XI { constructor(type, localName) { super(type, type, localName, true); } defaultValue() { return "0x"; } encode(writer, value) { value = (0,lib_esm.arrayify)(value); let length = writer.writeValue(value.length); length += writer.writeBytes(value); return length; } decode(reader) { return reader.readBytes(reader.readValue().toNumber(), true); } } class BytesCoder extends DynamicBytesCoder { constructor(localName) { super("bytes", localName); } decode(reader) { return reader.coerce(this.name, (0,lib_esm.hexlify)(super.decode(reader))); } } //# sourceMappingURL=bytes.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/abi/lib.esm/coders/fixed-bytes.js // @TODO: Merge this with bytes class FixedBytesCoder extends abstract_coder/* Coder */.XI { constructor(size, localName) { let name = "bytes" + String(size); super(name, name, localName, false); this.size = size; } defaultValue() { return ("0x0000000000000000000000000000000000000000000000000000000000000000").substring(0, 2 + this.size * 2); } encode(writer, value) { let data = (0,lib_esm.arrayify)(value); if (data.length !== this.size) { this._throwError("incorrect data length", value); } return writer.writeBytes(data); } decode(reader) { return reader.coerce(this.name, (0,lib_esm.hexlify)(reader.readBytes(this.size))); } } //# sourceMappingURL=fixed-bytes.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/abi/lib.esm/coders/null.js class NullCoder extends abstract_coder/* Coder */.XI { constructor(localName) { super("null", "", localName, false); } defaultValue() { return null; } encode(writer, value) { if (value != null) { this._throwError("not null", value); } return writer.writeBytes([]); } decode(reader) { reader.readBytes(0); return reader.coerce(this.name, null); } } //# sourceMappingURL=null.js.map // EXTERNAL MODULE: ./node_modules/@ethersproject/bignumber/lib.esm/bignumber.js var bignumber = __webpack_require__(2593); // EXTERNAL MODULE: ./node_modules/@ethersproject/constants/lib.esm/bignumbers.js var bignumbers = __webpack_require__(21046); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/abi/lib.esm/coders/number.js class NumberCoder extends abstract_coder/* Coder */.XI { constructor(size, signed, localName) { const name = ((signed ? "int" : "uint") + (size * 8)); super(name, name, localName, false); this.size = size; this.signed = signed; } defaultValue() { return 0; } encode(writer, value) { let v = bignumber/* BigNumber.from */.O$.from(value); // Check bounds are safe for encoding let maxUintValue = bignumbers/* MaxUint256.mask */.Bz.mask(writer.wordSize * 8); if (this.signed) { let bounds = maxUintValue.mask(this.size * 8 - 1); if (v.gt(bounds) || v.lt(bounds.add(bignumbers/* One */.fh).mul(bignumbers/* NegativeOne */.tL))) { this._throwError("value out-of-bounds", value); } } else if (v.lt(bignumbers/* Zero */._Y) || v.gt(maxUintValue.mask(this.size * 8))) { this._throwError("value out-of-bounds", value); } v = v.toTwos(this.size * 8).mask(this.size * 8); if (this.signed) { v = v.fromTwos(this.size * 8).toTwos(8 * writer.wordSize); } return writer.writeValue(v); } decode(reader) { let value = reader.readValue().mask(this.size * 8); if (this.signed) { value = value.fromTwos(this.size * 8); } return reader.coerce(this.name, value); } } //# sourceMappingURL=number.js.map // EXTERNAL MODULE: ./node_modules/@ethersproject/strings/lib.esm/utf8.js + 1 modules var utf8 = __webpack_require__(29251); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/abi/lib.esm/coders/string.js class StringCoder extends DynamicBytesCoder { constructor(localName) { super("string", localName); } defaultValue() { return ""; } encode(writer, value) { return super.encode(writer, (0,utf8/* toUtf8Bytes */.Y0)(value)); } decode(reader) { return (0,utf8/* toUtf8String */.ZN)(super.decode(reader)); } } //# sourceMappingURL=string.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/abi/lib.esm/coders/tuple.js class TupleCoder extends abstract_coder/* Coder */.XI { constructor(coders, localName) { let dynamic = false; const types = []; coders.forEach((coder) => { if (coder.dynamic) { dynamic = true; } types.push(coder.type); }); const type = ("tuple(" + types.join(",") + ")"); super("tuple", type, localName, dynamic); this.coders = coders; } defaultValue() { const values = []; this.coders.forEach((coder) => { values.push(coder.defaultValue()); }); // We only output named properties for uniquely named coders const uniqueNames = this.coders.reduce((accum, coder) => { const name = coder.localName; if (name) { if (!accum[name]) { accum[name] = 0; } accum[name]++; } return accum; }, {}); // Add named values this.coders.forEach((coder, index) => { let name = coder.localName; if (!name || uniqueNames[name] !== 1) { return; } if (name === "length") { name = "_length"; } if (values[name] != null) { return; } values[name] = values[index]; }); return Object.freeze(values); } encode(writer, value) { return pack(writer, this.coders, value); } decode(reader) { return reader.coerce(this.name, unpack(reader, this.coders)); } } //# sourceMappingURL=tuple.js.map // EXTERNAL MODULE: ./node_modules/@ethersproject/abi/lib.esm/fragments.js var fragments = __webpack_require__(11388); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/abi/lib.esm/abi-coder.js // See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI const abi_coder_logger = new logger_lib_esm.Logger(_version/* version */.i); const paramTypeBytes = new RegExp(/^bytes([0-9]*)$/); const paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/); class AbiCoder { constructor(coerceFunc) { (0,properties_lib_esm.defineReadOnly)(this, "coerceFunc", coerceFunc || null); } _getCoder(param) { switch (param.baseType) { case "address": return new AddressCoder(param.name); case "bool": return new BooleanCoder(param.name); case "string": return new StringCoder(param.name); case "bytes": return new BytesCoder(param.name); case "array": return new ArrayCoder(this._getCoder(param.arrayChildren), param.arrayLength, param.name); case "tuple": return new TupleCoder((param.components || []).map((component) => { return this._getCoder(component); }), param.name); case "": return new NullCoder(param.name); } // u?int[0-9]* let match = param.type.match(paramTypeNumber); if (match) { let size = parseInt(match[2] || "256"); if (size === 0 || size > 256 || (size % 8) !== 0) { abi_coder_logger.throwArgumentError("invalid " + match[1] + " bit length", "param", param); } return new NumberCoder(size / 8, (match[1] === "int"), param.name); } // bytes[0-9]+ match = param.type.match(paramTypeBytes); if (match) { let size = parseInt(match[1]); if (size === 0 || size > 32) { abi_coder_logger.throwArgumentError("invalid bytes length", "param", param); } return new FixedBytesCoder(size, param.name); } return abi_coder_logger.throwArgumentError("invalid type", "type", param.type); } _getWordSize() { return 32; } _getReader(data, allowLoose) { return new abstract_coder/* Reader */.Ej(data, this._getWordSize(), this.coerceFunc, allowLoose); } _getWriter() { return new abstract_coder/* Writer */.QV(this._getWordSize()); } getDefaultValue(types) { const coders = types.map((type) => this._getCoder(fragments/* ParamType.from */._R.from(type))); const coder = new TupleCoder(coders, "_"); return coder.defaultValue(); } encode(types, values) { if (types.length !== values.length) { abi_coder_logger.throwError("types/values length mismatch", logger_lib_esm.Logger.errors.INVALID_ARGUMENT, { count: { types: types.length, values: values.length }, value: { types: types, values: values } }); } const coders = types.map((type) => this._getCoder(fragments/* ParamType.from */._R.from(type))); const coder = (new TupleCoder(coders, "_")); const writer = this._getWriter(); coder.encode(writer, values); return writer.data; } decode(types, data, loose) { const coders = types.map((type) => this._getCoder(fragments/* ParamType.from */._R.from(type))); const coder = new TupleCoder(coders, "_"); return coder.decode(this._getReader((0,lib_esm.arrayify)(data), loose)); } } const defaultAbiCoder = new AbiCoder(); //# sourceMappingURL=abi-coder.js.map /***/ }), /***/ 61184: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "BR": function() { return /* binding */ checkResultErrors; }, /* harmony export */ "Ej": function() { return /* binding */ Reader; }, /* harmony export */ "QV": function() { return /* binding */ Writer; }, /* harmony export */ "XI": function() { return /* binding */ Coder; } /* harmony export */ }); /* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(16441); /* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2593); /* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6881); /* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1581); /* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(95851); const logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__/* .version */ .i); function checkResultErrors(result) { // Find the first error (if any) const errors = []; const checkErrors = function (path, object) { if (!Array.isArray(object)) { return; } for (let key in object) { const childPath = path.slice(); childPath.push(key); try { checkErrors(childPath, object[key]); } catch (error) { errors.push({ path: childPath, error: error }); } } }; checkErrors([], result); return errors; } class Coder { constructor(name, type, localName, dynamic) { // @TODO: defineReadOnly these this.name = name; this.type = type; this.localName = localName; this.dynamic = dynamic; } _throwError(message, value) { logger.throwArgumentError(message, this.localName, value); } } class Writer { constructor(wordSize) { (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.defineReadOnly)(this, "wordSize", wordSize || 32); this._data = []; this._dataLength = 0; this._padding = new Uint8Array(wordSize); } get data() { return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexConcat)(this._data); } get length() { return this._dataLength; } _writeData(data) { this._data.push(data); this._dataLength += data.length; return data.length; } appendWriter(writer) { return this._writeData((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.concat)(writer._data)); } // Arrayish items; padded on the right to wordSize writeBytes(value) { let bytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.arrayify)(value); const paddingOffset = bytes.length % this.wordSize; if (paddingOffset) { bytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.concat)([bytes, this._padding.slice(paddingOffset)]); } return this._writeData(bytes); } _getValue(value) { let bytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.arrayify)(_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__/* .BigNumber.from */ .O$.from(value)); if (bytes.length > this.wordSize) { logger.throwError("value out-of-bounds", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, { length: this.wordSize, offset: bytes.length }); } if (bytes.length % this.wordSize) { bytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.concat)([this._padding.slice(bytes.length % this.wordSize), bytes]); } return bytes; } // BigNumberish items; padded on the left to wordSize writeValue(value) { return this._writeData(this._getValue(value)); } writeUpdatableValue() { const offset = this._data.length; this._data.push(this._padding); this._dataLength += this.wordSize; return (value) => { this._data[offset] = this._getValue(value); }; } } class Reader { constructor(data, wordSize, coerceFunc, allowLoose) { (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.defineReadOnly)(this, "_data", (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.arrayify)(data)); (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.defineReadOnly)(this, "wordSize", wordSize || 32); (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.defineReadOnly)(this, "_coerceFunc", coerceFunc); (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.defineReadOnly)(this, "allowLoose", allowLoose); this._offset = 0; } get data() { return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexlify)(this._data); } get consumed() { return this._offset; } // The default Coerce function static coerce(name, value) { let match = name.match("^u?int([0-9]+)$"); if (match && parseInt(match[1]) <= 48) { value = value.toNumber(); } return value; } coerce(name, value) { if (this._coerceFunc) { return this._coerceFunc(name, value); } return Reader.coerce(name, value); } _peekBytes(offset, length, loose) { let alignedLength = Math.ceil(length / this.wordSize) * this.wordSize; if (this._offset + alignedLength > this._data.length) { if (this.allowLoose && loose && this._offset + length <= this._data.length) { alignedLength = length; } else { logger.throwError("data out-of-bounds", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.BUFFER_OVERRUN, { length: this._data.length, offset: this._offset + alignedLength }); } } return this._data.slice(this._offset, this._offset + alignedLength); } subReader(offset) { return new Reader(this._data.slice(this._offset + offset), this.wordSize, this._coerceFunc, this.allowLoose); } readBytes(length, loose) { let bytes = this._peekBytes(0, length, !!loose); this._offset += bytes.length; // @TODO: Make sure the length..end bytes are all 0? return bytes.slice(0, length); } readValue() { return _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__/* .BigNumber.from */ .O$.from(this.readBytes(this.wordSize)); } } //# sourceMappingURL=abstract-coder.js.map /***/ }), /***/ 11388: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "HY": function() { return /* binding */ Fragment; }, /* harmony export */ "IC": function() { return /* binding */ ErrorFragment; }, /* harmony export */ "QV": function() { return /* binding */ EventFragment; }, /* harmony export */ "Xg": function() { return /* binding */ ConstructorFragment; }, /* harmony export */ "YW": function() { return /* binding */ FunctionFragment; }, /* harmony export */ "_R": function() { return /* binding */ ParamType; }, /* harmony export */ "pc": function() { return /* binding */ FormatTypes; } /* harmony export */ }); /* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2593); /* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6881); /* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1581); /* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(95851); const logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__/* .version */ .i); ; const _constructorGuard = {}; let ModifiersBytes = { calldata: true, memory: true, storage: true }; let ModifiersNest = { calldata: true, memory: true }; function checkModifier(type, name) { if (type === "bytes" || type === "string") { if (ModifiersBytes[name]) { return true; } } else if (type === "address") { if (name === "payable") { return true; } } else if (type.indexOf("[") >= 0 || type === "tuple") { if (ModifiersNest[name]) { return true; } } if (ModifiersBytes[name] || name === "payable") { logger.throwArgumentError("invalid modifier", "name", name); } return false; } // @TODO: Make sure that children of an indexed tuple are marked with a null indexed function parseParamType(param, allowIndexed) { let originalParam = param; function throwError(i) { logger.throwArgumentError(`unexpected character at position ${i}`, "param", param); } param = param.replace(/\s/g, " "); function newNode(parent) { let node = { type: "", name: "", parent: parent, state: { allowType: true } }; if (allowIndexed) { node.indexed = false; } return node; } let parent = { type: "", name: "", state: { allowType: true } }; let node = parent; for (let i = 0; i < param.length; i++) { let c = param[i]; switch (c) { case "(": if (node.state.allowType && node.type === "") { node.type = "tuple"; } else if (!node.state.allowParams) { throwError(i); } node.state.allowType = false; node.type = verifyType(node.type); node.components = [newNode(node)]; node = node.components[0]; break; case ")": delete node.state; if (node.name === "indexed") { if (!allowIndexed) { throwError(i); } node.indexed = true; node.name = ""; } if (checkModifier(node.type, node.name)) { node.name = ""; } node.type = verifyType(node.type); let child = node; node = node.parent; if (!node) { throwError(i); } delete child.parent; node.state.allowParams = false; node.state.allowName = true; node.state.allowArray = true; break; case ",": delete node.state; if (node.name === "indexed") { if (!allowIndexed) { throwError(i); } node.indexed = true; node.name = ""; } if (checkModifier(node.type, node.name)) { node.name = ""; } node.type = verifyType(node.type); let sibling = newNode(node.parent); //{ type: "", name: "", parent: node.parent, state: { allowType: true } }; node.parent.components.push(sibling); delete node.parent; node = sibling; break; // Hit a space... case " ": // If reading type, the type is done and may read a param or name if (node.state.allowType) { if (node.type !== "") { node.type = verifyType(node.type); delete node.state.allowType; node.state.allowName = true; node.state.allowParams = true; } } // If reading name, the name is done if (node.state.allowName) { if (node.name !== "") { if (node.name === "indexed") { if (!allowIndexed) { throwError(i); } if (node.indexed) { throwError(i); } node.indexed = true; node.name = ""; } else if (checkModifier(node.type, node.name)) { node.name = ""; } else { node.state.allowName = false; } } } break; case "[": if (!node.state.allowArray) { throwError(i); } node.type += c; node.state.allowArray = false; node.state.allowName = false; node.state.readArray = true; break; case "]": if (!node.state.readArray) { throwError(i); } node.type += c; node.state.readArray = false; node.state.allowArray = true; node.state.allowName = true; break; default: if (node.state.allowType) { node.type += c; node.state.allowParams = true; node.state.allowArray = true; } else if (node.state.allowName) { node.name += c; delete node.state.allowArray; } else if (node.state.readArray) { node.type += c; } else { throwError(i); } } } if (node.parent) { logger.throwArgumentError("unexpected eof", "param", param); } delete parent.state; if (node.name === "indexed") { if (!allowIndexed) { throwError(originalParam.length - 7); } if (node.indexed) { throwError(originalParam.length - 7); } node.indexed = true; node.name = ""; } else if (checkModifier(node.type, node.name)) { node.name = ""; } parent.type = verifyType(parent.type); return parent; } function populate(object, params) { for (let key in params) { (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.defineReadOnly)(object, key, params[key]); } } const FormatTypes = Object.freeze({ // Bare formatting, as is needed for computing a sighash of an event or function sighash: "sighash", // Human-Readable with Minimal spacing and without names (compact human-readable) minimal: "minimal", // Human-Readable with nice spacing, including all names full: "full", // JSON-format a la Solidity json: "json" }); const paramTypeArray = new RegExp(/^(.*)\[([0-9]*)\]$/); class ParamType { constructor(constructorGuard, params) { if (constructorGuard !== _constructorGuard) { logger.throwError("use fromString", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.UNSUPPORTED_OPERATION, { operation: "new ParamType()" }); } populate(this, params); let match = this.type.match(paramTypeArray); if (match) { populate(this, { arrayLength: parseInt(match[2] || "-1"), arrayChildren: ParamType.fromObject({ type: match[1], components: this.components }), baseType: "array" }); } else { populate(this, { arrayLength: null, arrayChildren: null, baseType: ((this.components != null) ? "tuple" : this.type) }); } this._isParamType = true; Object.freeze(this); } // Format the parameter fragment // - sighash: "(uint256,address)" // - minimal: "tuple(uint256,address) indexed" // - full: "tuple(uint256 foo, address bar) indexed baz" format(format) { if (!format) { format = FormatTypes.sighash; } if (!FormatTypes[format]) { logger.throwArgumentError("invalid format type", "format", format); } if (format === FormatTypes.json) { let result = { type: ((this.baseType === "tuple") ? "tuple" : this.type), name: (this.name || undefined) }; if (typeof (this.indexed) === "boolean") { result.indexed = this.indexed; } if (this.components) { result.components = this.components.map((comp) => JSON.parse(comp.format(format))); } return JSON.stringify(result); } let result = ""; // Array if (this.baseType === "array") { result += this.arrayChildren.format(format); result += "[" + (this.arrayLength < 0 ? "" : String(this.arrayLength)) + "]"; } else { if (this.baseType === "tuple") { if (format !== FormatTypes.sighash) { result += this.type; } result += "(" + this.components.map((comp) => comp.format(format)).join((format === FormatTypes.full) ? ", " : ",") + ")"; } else { result += this.type; } } if (format !== FormatTypes.sighash) { if (this.indexed === true) { result += " indexed"; } if (format === FormatTypes.full && this.name) { result += " " + this.name; } } return result; } static from(value, allowIndexed) { if (typeof (value) === "string") { return ParamType.fromString(value, allowIndexed); } return ParamType.fromObject(value); } static fromObject(value) { if (ParamType.isParamType(value)) { return value; } return new ParamType(_constructorGuard, { name: (value.name || null), type: verifyType(value.type), indexed: ((value.indexed == null) ? null : !!value.indexed), components: (value.components ? value.components.map(ParamType.fromObject) : null) }); } static fromString(value, allowIndexed) { function ParamTypify(node) { return ParamType.fromObject({ name: node.name, type: node.type, indexed: node.indexed, components: node.components }); } return ParamTypify(parseParamType(value, !!allowIndexed)); } static isParamType(value) { return !!(value != null && value._isParamType); } } ; function parseParams(value, allowIndex) { return splitNesting(value).map((param) => ParamType.fromString(param, allowIndex)); } class Fragment { constructor(constructorGuard, params) { if (constructorGuard !== _constructorGuard) { logger.throwError("use a static from method", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.UNSUPPORTED_OPERATION, { operation: "new Fragment()" }); } populate(this, params); this._isFragment = true; Object.freeze(this); } static from(value) { if (Fragment.isFragment(value)) { return value; } if (typeof (value) === "string") { return Fragment.fromString(value); } return Fragment.fromObject(value); } static fromObject(value) { if (Fragment.isFragment(value)) { return value; } switch (value.type) { case "function": return FunctionFragment.fromObject(value); case "event": return EventFragment.fromObject(value); case "constructor": return ConstructorFragment.fromObject(value); case "error": return ErrorFragment.fromObject(value); case "fallback": case "receive": // @TODO: Something? Maybe return a FunctionFragment? A custom DefaultFunctionFragment? return null; } return logger.throwArgumentError("invalid fragment object", "value", value); } static fromString(value) { // Make sure the "returns" is surrounded by a space and all whitespace is exactly one space value = value.replace(/\s/g, " "); value = value.replace(/\(/g, " (").replace(/\)/g, ") ").replace(/\s+/g, " "); value = value.trim(); if (value.split(" ")[0] === "event") { return EventFragment.fromString(value.substring(5).trim()); } else if (value.split(" ")[0] === "function") { return FunctionFragment.fromString(value.substring(8).trim()); } else if (value.split("(")[0].trim() === "constructor") { return ConstructorFragment.fromString(value.trim()); } else if (value.split(" ")[0] === "error") { return ErrorFragment.fromString(value.substring(5).trim()); } return logger.throwArgumentError("unsupported fragment", "value", value); } static isFragment(value) { return !!(value && value._isFragment); } } class EventFragment extends Fragment { format(format) { if (!format) { format = FormatTypes.sighash; } if (!FormatTypes[format]) { logger.throwArgumentError("invalid format type", "format", format); } if (format === FormatTypes.json) { return JSON.stringify({ type: "event", anonymous: this.anonymous, name: this.name, inputs: this.inputs.map((input) => JSON.parse(input.format(format))) }); } let result = ""; if (format !== FormatTypes.sighash) { result += "event "; } result += this.name + "(" + this.inputs.map((input) => input.format(format)).join((format === FormatTypes.full) ? ", " : ",") + ") "; if (format !== FormatTypes.sighash) { if (this.anonymous) { result += "anonymous "; } } return result.trim(); } static from(value) { if (typeof (value) === "string") { return EventFragment.fromString(value); } return EventFragment.fromObject(value); } static fromObject(value) { if (EventFragment.isEventFragment(value)) { return value; } if (value.type !== "event") { logger.throwArgumentError("invalid event object", "value", value); } const params = { name: verifyIdentifier(value.name), anonymous: value.anonymous, inputs: (value.inputs ? value.inputs.map(ParamType.fromObject) : []), type: "event" }; return new EventFragment(_constructorGuard, params); } static fromString(value) { let match = value.match(regexParen); if (!match) { logger.throwArgumentError("invalid event string", "value", value); } let anonymous = false; match[3].split(" ").forEach((modifier) => { switch (modifier.trim()) { case "anonymous": anonymous = true; break; case "": break; default: logger.warn("unknown modifier: " + modifier); } }); return EventFragment.fromObject({ name: match[1].trim(), anonymous: anonymous, inputs: parseParams(match[2], true), type: "event" }); } static isEventFragment(value) { return (value && value._isFragment && value.type === "event"); } } function parseGas(value, params) { params.gas = null; let comps = value.split("@"); if (comps.length !== 1) { if (comps.length > 2) { logger.throwArgumentError("invalid human-readable ABI signature", "value", value); } if (!comps[1].match(/^[0-9]+$/)) { logger.throwArgumentError("invalid human-readable ABI signature gas", "value", value); } params.gas = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_3__/* .BigNumber.from */ .O$.from(comps[1]); return comps[0]; } return value; } function parseModifiers(value, params) { params.constant = false; params.payable = false; params.stateMutability = "nonpayable"; value.split(" ").forEach((modifier) => { switch (modifier.trim()) { case "constant": params.constant = true; break; case "payable": params.payable = true; params.stateMutability = "payable"; break; case "nonpayable": params.payable = false; params.stateMutability = "nonpayable"; break; case "pure": params.constant = true; params.stateMutability = "pure"; break; case "view": params.constant = true; params.stateMutability = "view"; break; case "external": case "public": case "": break; default: console.log("unknown modifier: " + modifier); } }); } function verifyState(value) { let result = { constant: false, payable: true, stateMutability: "payable" }; if (value.stateMutability != null) { result.stateMutability = value.stateMutability; // Set (and check things are consistent) the constant property result.constant = (result.stateMutability === "view" || result.stateMutability === "pure"); if (value.constant != null) { if ((!!value.constant) !== result.constant) { logger.throwArgumentError("cannot have constant function with mutability " + result.stateMutability, "value", value); } } // Set (and check things are consistent) the payable property result.payable = (result.stateMutability === "payable"); if (value.payable != null) { if ((!!value.payable) !== result.payable) { logger.throwArgumentError("cannot have payable function with mutability " + result.stateMutability, "value", value); } } } else if (value.payable != null) { result.payable = !!value.payable; // If payable we can assume non-constant; otherwise we can't assume if (value.constant == null && !result.payable && value.type !== "constructor") { logger.throwArgumentError("unable to determine stateMutability", "value", value); } result.constant = !!value.constant; if (result.constant) { result.stateMutability = "view"; } else { result.stateMutability = (result.payable ? "payable" : "nonpayable"); } if (result.payable && result.constant) { logger.throwArgumentError("cannot have constant payable function", "value", value); } } else if (value.constant != null) { result.constant = !!value.constant; result.payable = !result.constant; result.stateMutability = (result.constant ? "view" : "payable"); } else if (value.type !== "constructor") { logger.throwArgumentError("unable to determine stateMutability", "value", value); } return result; } class ConstructorFragment extends Fragment { format(format) { if (!format) { format = FormatTypes.sighash; } if (!FormatTypes[format]) { logger.throwArgumentError("invalid format type", "format", format); } if (format === FormatTypes.json) { return JSON.stringify({ type: "constructor", stateMutability: ((this.stateMutability !== "nonpayable") ? this.stateMutability : undefined), payable: this.payable, gas: (this.gas ? this.gas.toNumber() : undefined), inputs: this.inputs.map((input) => JSON.parse(input.format(format))) }); } if (format === FormatTypes.sighash) { logger.throwError("cannot format a constructor for sighash", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.UNSUPPORTED_OPERATION, { operation: "format(sighash)" }); } let result = "constructor(" + this.inputs.map((input) => input.format(format)).join((format === FormatTypes.full) ? ", " : ",") + ") "; if (this.stateMutability && this.stateMutability !== "nonpayable") { result += this.stateMutability + " "; } return result.trim(); } static from(value) { if (typeof (value) === "string") { return ConstructorFragment.fromString(value); } return ConstructorFragment.fromObject(value); } static fromObject(value) { if (ConstructorFragment.isConstructorFragment(value)) { return value; } if (value.type !== "constructor") { logger.throwArgumentError("invalid constructor object", "value", value); } let state = verifyState(value); if (state.constant) { logger.throwArgumentError("constructor cannot be constant", "value", value); } const params = { name: null, type: value.type, inputs: (value.inputs ? value.inputs.map(ParamType.fromObject) : []), payable: state.payable, stateMutability: state.stateMutability, gas: (value.gas ? _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_3__/* .BigNumber.from */ .O$.from(value.gas) : null) }; return new ConstructorFragment(_constructorGuard, params); } static fromString(value) { let params = { type: "constructor" }; value = parseGas(value, params); let parens = value.match(regexParen); if (!parens || parens[1].trim() !== "constructor") { logger.throwArgumentError("invalid constructor string", "value", value); } params.inputs = parseParams(parens[2].trim(), false); parseModifiers(parens[3].trim(), params); return ConstructorFragment.fromObject(params); } static isConstructorFragment(value) { return (value && value._isFragment && value.type === "constructor"); } } class FunctionFragment extends ConstructorFragment { format(format) { if (!format) { format = FormatTypes.sighash; } if (!FormatTypes[format]) { logger.throwArgumentError("invalid format type", "format", format); } if (format === FormatTypes.json) { return JSON.stringify({ type: "function", name: this.name, constant: this.constant, stateMutability: ((this.stateMutability !== "nonpayable") ? this.stateMutability : undefined), payable: this.payable, gas: (this.gas ? this.gas.toNumber() : undefined), inputs: this.inputs.map((input) => JSON.parse(input.format(format))), outputs: this.outputs.map((output) => JSON.parse(output.format(format))), }); } let result = ""; if (format !== FormatTypes.sighash) { result += "function "; } result += this.name + "(" + this.inputs.map((input) => input.format(format)).join((format === FormatTypes.full) ? ", " : ",") + ") "; if (format !== FormatTypes.sighash) { if (this.stateMutability) { if (this.stateMutability !== "nonpayable") { result += (this.stateMutability + " "); } } else if (this.constant) { result += "view "; } if (this.outputs && this.outputs.length) { result += "returns (" + this.outputs.map((output) => output.format(format)).join(", ") + ") "; } if (this.gas != null) { result += "@" + this.gas.toString() + " "; } } return result.trim(); } static from(value) { if (typeof (value) === "string") { return FunctionFragment.fromString(value); } return FunctionFragment.fromObject(value); } static fromObject(value) { if (FunctionFragment.isFunctionFragment(value)) { return value; } if (value.type !== "function") { logger.throwArgumentError("invalid function object", "value", value); } let state = verifyState(value); const params = { type: value.type, name: verifyIdentifier(value.name), constant: state.constant, inputs: (value.inputs ? value.inputs.map(ParamType.fromObject) : []), outputs: (value.outputs ? value.outputs.map(ParamType.fromObject) : []), payable: state.payable, stateMutability: state.stateMutability, gas: (value.gas ? _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_3__/* .BigNumber.from */ .O$.from(value.gas) : null) }; return new FunctionFragment(_constructorGuard, params); } static fromString(value) { let params = { type: "function" }; value = parseGas(value, params); let comps = value.split(" returns "); if (comps.length > 2) { logger.throwArgumentError("invalid function string", "value", value); } let parens = comps[0].match(regexParen); if (!parens) { logger.throwArgumentError("invalid function signature", "value", value); } params.name = parens[1].trim(); if (params.name) { verifyIdentifier(params.name); } params.inputs = parseParams(parens[2], false); parseModifiers(parens[3].trim(), params); // We have outputs if (comps.length > 1) { let returns = comps[1].match(regexParen); if (returns[1].trim() != "" || returns[3].trim() != "") { logger.throwArgumentError("unexpected tokens", "value", value); } params.outputs = parseParams(returns[2], false); } else { params.outputs = []; } return FunctionFragment.fromObject(params); } static isFunctionFragment(value) { return (value && value._isFragment && value.type === "function"); } } //export class StructFragment extends Fragment { //} function checkForbidden(fragment) { const sig = fragment.format(); if (sig === "Error(string)" || sig === "Panic(uint256)") { logger.throwArgumentError(`cannot specify user defined ${sig} error`, "fragment", fragment); } return fragment; } class ErrorFragment extends Fragment { format(format) { if (!format) { format = FormatTypes.sighash; } if (!FormatTypes[format]) { logger.throwArgumentError("invalid format type", "format", format); } if (format === FormatTypes.json) { return JSON.stringify({ type: "error", name: this.name, inputs: this.inputs.map((input) => JSON.parse(input.format(format))), }); } let result = ""; if (format !== FormatTypes.sighash) { result += "error "; } result += this.name + "(" + this.inputs.map((input) => input.format(format)).join((format === FormatTypes.full) ? ", " : ",") + ") "; return result.trim(); } static from(value) { if (typeof (value) === "string") { return ErrorFragment.fromString(value); } return ErrorFragment.fromObject(value); } static fromObject(value) { if (ErrorFragment.isErrorFragment(value)) { return value; } if (value.type !== "error") { logger.throwArgumentError("invalid error object", "value", value); } const params = { type: value.type, name: verifyIdentifier(value.name), inputs: (value.inputs ? value.inputs.map(ParamType.fromObject) : []) }; return checkForbidden(new ErrorFragment(_constructorGuard, params)); } static fromString(value) { let params = { type: "error" }; let parens = value.match(regexParen); if (!parens) { logger.throwArgumentError("invalid error signature", "value", value); } params.name = parens[1].trim(); if (params.name) { verifyIdentifier(params.name); } params.inputs = parseParams(parens[2], false); return checkForbidden(ErrorFragment.fromObject(params)); } static isErrorFragment(value) { return (value && value._isFragment && value.type === "error"); } } function verifyType(type) { // These need to be transformed to their full description if (type.match(/^uint($|[^1-9])/)) { type = "uint256" + type.substring(4); } else if (type.match(/^int($|[^1-9])/)) { type = "int256" + type.substring(3); } // @TODO: more verification return type; } // See: https://github.com/ethereum/solidity/blob/1f8f1a3db93a548d0555e3e14cfc55a10e25b60e/docs/grammar/SolidityLexer.g4#L234 const regexIdentifier = new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$"); function verifyIdentifier(value) { if (!value || !value.match(regexIdentifier)) { logger.throwArgumentError(`invalid identifier "${value}"`, "value", value); } return value; } const regexParen = new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$"); function splitNesting(value) { value = value.trim(); let result = []; let accum = ""; let depth = 0; for (let offset = 0; offset < value.length; offset++) { let c = value[offset]; if (c === "," && depth === 0) { result.push(accum); accum = ""; } else { accum += c; if (c === "(") { depth++; } else if (c === ")") { depth--; if (depth === -1) { logger.throwArgumentError("unbalanced parenthesis", "value", value); } } } } if (accum) { result.push(accum); } return result; } //# sourceMappingURL=fragments.js.map /***/ }), /***/ 83893: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "AbiCoder": function() { return /* reexport safe */ _abi_coder__WEBPACK_IMPORTED_MODULE_1__.R; }, /* harmony export */ "ConstructorFragment": function() { return /* reexport safe */ _fragments__WEBPACK_IMPORTED_MODULE_0__.Xg; }, /* harmony export */ "ErrorFragment": function() { return /* reexport safe */ _fragments__WEBPACK_IMPORTED_MODULE_0__.IC; }, /* harmony export */ "EventFragment": function() { return /* reexport safe */ _fragments__WEBPACK_IMPORTED_MODULE_0__.QV; }, /* harmony export */ "FormatTypes": function() { return /* reexport safe */ _fragments__WEBPACK_IMPORTED_MODULE_0__.pc; }, /* harmony export */ "Fragment": function() { return /* reexport safe */ _fragments__WEBPACK_IMPORTED_MODULE_0__.HY; }, /* harmony export */ "FunctionFragment": function() { return /* reexport safe */ _fragments__WEBPACK_IMPORTED_MODULE_0__.YW; }, /* harmony export */ "Indexed": function() { return /* reexport safe */ _interface__WEBPACK_IMPORTED_MODULE_2__.Hk; }, /* harmony export */ "Interface": function() { return /* reexport safe */ _interface__WEBPACK_IMPORTED_MODULE_2__.vU; }, /* harmony export */ "LogDescription": function() { return /* reexport safe */ _interface__WEBPACK_IMPORTED_MODULE_2__.CC; }, /* harmony export */ "ParamType": function() { return /* reexport safe */ _fragments__WEBPACK_IMPORTED_MODULE_0__._R; }, /* harmony export */ "TransactionDescription": function() { return /* reexport safe */ _interface__WEBPACK_IMPORTED_MODULE_2__.vk; }, /* harmony export */ "checkResultErrors": function() { return /* reexport safe */ _interface__WEBPACK_IMPORTED_MODULE_3__.BR; }, /* harmony export */ "defaultAbiCoder": function() { return /* reexport safe */ _abi_coder__WEBPACK_IMPORTED_MODULE_1__.$; } /* harmony export */ }); /* harmony import */ var _fragments__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11388); /* harmony import */ var _abi_coder__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84243); /* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8198); /* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(61184); //# sourceMappingURL=index.js.map /***/ }), /***/ 8198: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "CC": function() { return /* binding */ LogDescription; }, /* harmony export */ "Hk": function() { return /* binding */ Indexed; }, /* harmony export */ "vU": function() { return /* binding */ Interface; }, /* harmony export */ "vk": function() { return /* binding */ TransactionDescription; } /* harmony export */ }); /* unused harmony export ErrorDescription */ /* harmony import */ var _ethersproject_address__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(19485); /* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(2593); /* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(16441); /* harmony import */ var _ethersproject_hash__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(32046); /* harmony import */ var _ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(38197); /* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6881); /* harmony import */ var _abi_coder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(84243); /* harmony import */ var _fragments__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(11388); /* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1581); /* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(95851); const logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__/* .version */ .i); class LogDescription extends _ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.Description { } class TransactionDescription extends _ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.Description { } class ErrorDescription extends _ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.Description { } class Indexed extends _ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.Description { static isIndexed(value) { return !!(value && value._isIndexed); } } const BuiltinErrors = { "0x08c379a0": { signature: "Error(string)", name: "Error", inputs: ["string"], reason: true }, "0x4e487b71": { signature: "Panic(uint256)", name: "Panic", inputs: ["uint256"] } }; function wrapAccessError(property, error) { const wrap = new Error(`deferred error during ABI decoding triggered accessing ${property}`); wrap.error = error; return wrap; } /* function checkNames(fragment: Fragment, type: "input" | "output", params: Array): void { params.reduce((accum, param) => { if (param.name) { if (accum[param.name]) { logger.throwArgumentError(`duplicate ${ type } parameter ${ JSON.stringify(param.name) } in ${ fragment.format("full") }`, "fragment", fragment); } accum[param.name] = true; } return accum; }, <{ [ name: string ]: boolean }>{ }); } */ class Interface { constructor(fragments) { let abi = []; if (typeof (fragments) === "string") { abi = JSON.parse(fragments); } else { abi = fragments; } (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.defineReadOnly)(this, "fragments", abi.map((fragment) => { return _fragments__WEBPACK_IMPORTED_MODULE_3__/* .Fragment.from */ .HY.from(fragment); }).filter((fragment) => (fragment != null))); (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.defineReadOnly)(this, "_abiCoder", (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.getStatic)(new.target, "getAbiCoder")()); (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.defineReadOnly)(this, "functions", {}); (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.defineReadOnly)(this, "errors", {}); (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.defineReadOnly)(this, "events", {}); (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.defineReadOnly)(this, "structs", {}); // Add all fragments by their signature this.fragments.forEach((fragment) => { let bucket = null; switch (fragment.type) { case "constructor": if (this.deploy) { logger.warn("duplicate definition - constructor"); return; } //checkNames(fragment, "input", fragment.inputs); (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.defineReadOnly)(this, "deploy", fragment); return; case "function": //checkNames(fragment, "input", fragment.inputs); //checkNames(fragment, "output", (fragment).outputs); bucket = this.functions; break; case "event": //checkNames(fragment, "input", fragment.inputs); bucket = this.events; break; case "error": bucket = this.errors; break; default: return; } let signature = fragment.format(); if (bucket[signature]) { logger.warn("duplicate definition - " + signature); return; } bucket[signature] = fragment; }); // If we do not have a constructor add a default if (!this.deploy) { (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.defineReadOnly)(this, "deploy", _fragments__WEBPACK_IMPORTED_MODULE_3__/* .ConstructorFragment.from */ .Xg.from({ payable: false, type: "constructor" })); } (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.defineReadOnly)(this, "_isInterface", true); } format(format) { if (!format) { format = _fragments__WEBPACK_IMPORTED_MODULE_3__/* .FormatTypes.full */ .pc.full; } if (format === _fragments__WEBPACK_IMPORTED_MODULE_3__/* .FormatTypes.sighash */ .pc.sighash) { logger.throwArgumentError("interface does not support formatting sighash", "format", format); } const abi = this.fragments.map((fragment) => fragment.format(format)); // We need to re-bundle the JSON fragments a bit if (format === _fragments__WEBPACK_IMPORTED_MODULE_3__/* .FormatTypes.json */ .pc.json) { return JSON.stringify(abi.map((j) => JSON.parse(j))); } return abi; } // Sub-classes can override these to handle other blockchains static getAbiCoder() { return _abi_coder__WEBPACK_IMPORTED_MODULE_4__/* .defaultAbiCoder */ .$; } static getAddress(address) { return (0,_ethersproject_address__WEBPACK_IMPORTED_MODULE_5__.getAddress)(address); } static getSighash(fragment) { return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexDataSlice)((0,_ethersproject_hash__WEBPACK_IMPORTED_MODULE_7__.id)(fragment.format()), 0, 4); } static getEventTopic(eventFragment) { return (0,_ethersproject_hash__WEBPACK_IMPORTED_MODULE_7__.id)(eventFragment.format()); } // Find a function definition by any means necessary (unless it is ambiguous) getFunction(nameOrSignatureOrSighash) { if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.isHexString)(nameOrSignatureOrSighash)) { for (const name in this.functions) { if (nameOrSignatureOrSighash === this.getSighash(name)) { return this.functions[name]; } } logger.throwArgumentError("no matching function", "sighash", nameOrSignatureOrSighash); } // It is a bare name, look up the function (will return null if ambiguous) if (nameOrSignatureOrSighash.indexOf("(") === -1) { const name = nameOrSignatureOrSighash.trim(); const matching = Object.keys(this.functions).filter((f) => (f.split("(" /* fix:) */)[0] === name)); if (matching.length === 0) { logger.throwArgumentError("no matching function", "name", name); } else if (matching.length > 1) { logger.throwArgumentError("multiple matching functions", "name", name); } return this.functions[matching[0]]; } // Normalize the signature and lookup the function const result = this.functions[_fragments__WEBPACK_IMPORTED_MODULE_3__/* .FunctionFragment.fromString */ .YW.fromString(nameOrSignatureOrSighash).format()]; if (!result) { logger.throwArgumentError("no matching function", "signature", nameOrSignatureOrSighash); } return result; } // Find an event definition by any means necessary (unless it is ambiguous) getEvent(nameOrSignatureOrTopic) { if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.isHexString)(nameOrSignatureOrTopic)) { const topichash = nameOrSignatureOrTopic.toLowerCase(); for (const name in this.events) { if (topichash === this.getEventTopic(name)) { return this.events[name]; } } logger.throwArgumentError("no matching event", "topichash", topichash); } // It is a bare name, look up the function (will return null if ambiguous) if (nameOrSignatureOrTopic.indexOf("(") === -1) { const name = nameOrSignatureOrTopic.trim(); const matching = Object.keys(this.events).filter((f) => (f.split("(" /* fix:) */)[0] === name)); if (matching.length === 0) { logger.throwArgumentError("no matching event", "name", name); } else if (matching.length > 1) { logger.throwArgumentError("multiple matching events", "name", name); } return this.events[matching[0]]; } // Normalize the signature and lookup the function const result = this.events[_fragments__WEBPACK_IMPORTED_MODULE_3__/* .EventFragment.fromString */ .QV.fromString(nameOrSignatureOrTopic).format()]; if (!result) { logger.throwArgumentError("no matching event", "signature", nameOrSignatureOrTopic); } return result; } // Find a function definition by any means necessary (unless it is ambiguous) getError(nameOrSignatureOrSighash) { if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.isHexString)(nameOrSignatureOrSighash)) { const getSighash = (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.getStatic)(this.constructor, "getSighash"); for (const name in this.errors) { const error = this.errors[name]; if (nameOrSignatureOrSighash === getSighash(error)) { return this.errors[name]; } } logger.throwArgumentError("no matching error", "sighash", nameOrSignatureOrSighash); } // It is a bare name, look up the function (will return null if ambiguous) if (nameOrSignatureOrSighash.indexOf("(") === -1) { const name = nameOrSignatureOrSighash.trim(); const matching = Object.keys(this.errors).filter((f) => (f.split("(" /* fix:) */)[0] === name)); if (matching.length === 0) { logger.throwArgumentError("no matching error", "name", name); } else if (matching.length > 1) { logger.throwArgumentError("multiple matching errors", "name", name); } return this.errors[matching[0]]; } // Normalize the signature and lookup the function const result = this.errors[_fragments__WEBPACK_IMPORTED_MODULE_3__/* .FunctionFragment.fromString */ .YW.fromString(nameOrSignatureOrSighash).format()]; if (!result) { logger.throwArgumentError("no matching error", "signature", nameOrSignatureOrSighash); } return result; } // Get the sighash (the bytes4 selector) used by Solidity to identify a function getSighash(fragment) { if (typeof (fragment) === "string") { try { fragment = this.getFunction(fragment); } catch (error) { try { fragment = this.getError(fragment); } catch (_) { throw error; } } } return (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.getStatic)(this.constructor, "getSighash")(fragment); } // Get the topic (the bytes32 hash) used by Solidity to identify an event getEventTopic(eventFragment) { if (typeof (eventFragment) === "string") { eventFragment = this.getEvent(eventFragment); } return (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.getStatic)(this.constructor, "getEventTopic")(eventFragment); } _decodeParams(params, data) { return this._abiCoder.decode(params, data); } _encodeParams(params, values) { return this._abiCoder.encode(params, values); } encodeDeploy(values) { return this._encodeParams(this.deploy.inputs, values || []); } decodeErrorResult(fragment, data) { if (typeof (fragment) === "string") { fragment = this.getError(fragment); } const bytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)(data); if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(bytes.slice(0, 4)) !== this.getSighash(fragment)) { logger.throwArgumentError(`data signature does not match error ${fragment.name}.`, "data", (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(bytes)); } return this._decodeParams(fragment.inputs, bytes.slice(4)); } encodeErrorResult(fragment, values) { if (typeof (fragment) === "string") { fragment = this.getError(fragment); } return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.concat)([ this.getSighash(fragment), this._encodeParams(fragment.inputs, values || []) ])); } // Decode the data for a function call (e.g. tx.data) decodeFunctionData(functionFragment, data) { if (typeof (functionFragment) === "string") { functionFragment = this.getFunction(functionFragment); } const bytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)(data); if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(bytes.slice(0, 4)) !== this.getSighash(functionFragment)) { logger.throwArgumentError(`data signature does not match function ${functionFragment.name}.`, "data", (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(bytes)); } return this._decodeParams(functionFragment.inputs, bytes.slice(4)); } // Encode the data for a function call (e.g. tx.data) encodeFunctionData(functionFragment, values) { if (typeof (functionFragment) === "string") { functionFragment = this.getFunction(functionFragment); } return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.concat)([ this.getSighash(functionFragment), this._encodeParams(functionFragment.inputs, values || []) ])); } // Decode the result from a function call (e.g. from eth_call) decodeFunctionResult(functionFragment, data) { if (typeof (functionFragment) === "string") { functionFragment = this.getFunction(functionFragment); } let bytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)(data); let reason = null; let message = ""; let errorArgs = null; let errorName = null; let errorSignature = null; switch (bytes.length % this._abiCoder._getWordSize()) { case 0: try { return this._abiCoder.decode(functionFragment.outputs, bytes); } catch (error) { } break; case 4: { const selector = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(bytes.slice(0, 4)); const builtin = BuiltinErrors[selector]; if (builtin) { errorArgs = this._abiCoder.decode(builtin.inputs, bytes.slice(4)); errorName = builtin.name; errorSignature = builtin.signature; if (builtin.reason) { reason = errorArgs[0]; } if (errorName === "Error") { message = `; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(errorArgs[0])}`; } else if (errorName === "Panic") { message = `; VM Exception while processing transaction: reverted with panic code ${errorArgs[0]}`; } } else { try { const error = this.getError(selector); errorArgs = this._abiCoder.decode(error.inputs, bytes.slice(4)); errorName = error.name; errorSignature = error.format(); } catch (error) { } } break; } } return logger.throwError("call revert exception" + message, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.CALL_EXCEPTION, { method: functionFragment.format(), data: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(data), errorArgs, errorName, errorSignature, reason }); } // Encode the result for a function call (e.g. for eth_call) encodeFunctionResult(functionFragment, values) { if (typeof (functionFragment) === "string") { functionFragment = this.getFunction(functionFragment); } return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(this._abiCoder.encode(functionFragment.outputs, values || [])); } // Create the filter for the event with search criteria (e.g. for eth_filterLog) encodeFilterTopics(eventFragment, values) { if (typeof (eventFragment) === "string") { eventFragment = this.getEvent(eventFragment); } if (values.length > eventFragment.inputs.length) { logger.throwError("too many arguments for " + eventFragment.format(), _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.UNEXPECTED_ARGUMENT, { argument: "values", value: values }); } let topics = []; if (!eventFragment.anonymous) { topics.push(this.getEventTopic(eventFragment)); } const encodeTopic = (param, value) => { if (param.type === "string") { return (0,_ethersproject_hash__WEBPACK_IMPORTED_MODULE_7__.id)(value); } else if (param.type === "bytes") { return (0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_8__.keccak256)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(value)); } if (param.type === "bool" && typeof (value) === "boolean") { value = (value ? "0x01" : "0x00"); } if (param.type.match(/^u?int/)) { value = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_9__/* .BigNumber.from */ .O$.from(value).toHexString(); } // Check addresses are valid if (param.type === "address") { this._abiCoder.encode(["address"], [value]); } return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexZeroPad)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(value), 32); }; values.forEach((value, index) => { let param = eventFragment.inputs[index]; if (!param.indexed) { if (value != null) { logger.throwArgumentError("cannot filter non-indexed parameters; must be null", ("contract." + param.name), value); } return; } if (value == null) { topics.push(null); } else if (param.baseType === "array" || param.baseType === "tuple") { logger.throwArgumentError("filtering with tuples or arrays not supported", ("contract." + param.name), value); } else if (Array.isArray(value)) { topics.push(value.map((value) => encodeTopic(param, value))); } else { topics.push(encodeTopic(param, value)); } }); // Trim off trailing nulls while (topics.length && topics[topics.length - 1] === null) { topics.pop(); } return topics; } encodeEventLog(eventFragment, values) { if (typeof (eventFragment) === "string") { eventFragment = this.getEvent(eventFragment); } const topics = []; const dataTypes = []; const dataValues = []; if (!eventFragment.anonymous) { topics.push(this.getEventTopic(eventFragment)); } if (values.length !== eventFragment.inputs.length) { logger.throwArgumentError("event arguments/values mismatch", "values", values); } eventFragment.inputs.forEach((param, index) => { const value = values[index]; if (param.indexed) { if (param.type === "string") { topics.push((0,_ethersproject_hash__WEBPACK_IMPORTED_MODULE_7__.id)(value)); } else if (param.type === "bytes") { topics.push((0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_8__.keccak256)(value)); } else if (param.baseType === "tuple" || param.baseType === "array") { // @TODO throw new Error("not implemented"); } else { topics.push(this._abiCoder.encode([param.type], [value])); } } else { dataTypes.push(param); dataValues.push(value); } }); return { data: this._abiCoder.encode(dataTypes, dataValues), topics: topics }; } // Decode a filter for the event and the search criteria decodeEventLog(eventFragment, data, topics) { if (typeof (eventFragment) === "string") { eventFragment = this.getEvent(eventFragment); } if (topics != null && !eventFragment.anonymous) { let topicHash = this.getEventTopic(eventFragment); if (!(0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.isHexString)(topics[0], 32) || topics[0].toLowerCase() !== topicHash) { logger.throwError("fragment/topic mismatch", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.INVALID_ARGUMENT, { argument: "topics[0]", expected: topicHash, value: topics[0] }); } topics = topics.slice(1); } let indexed = []; let nonIndexed = []; let dynamic = []; eventFragment.inputs.forEach((param, index) => { if (param.indexed) { if (param.type === "string" || param.type === "bytes" || param.baseType === "tuple" || param.baseType === "array") { indexed.push(_fragments__WEBPACK_IMPORTED_MODULE_3__/* .ParamType.fromObject */ ._R.fromObject({ type: "bytes32", name: param.name })); dynamic.push(true); } else { indexed.push(param); dynamic.push(false); } } else { nonIndexed.push(param); dynamic.push(false); } }); let resultIndexed = (topics != null) ? this._abiCoder.decode(indexed, (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.concat)(topics)) : null; let resultNonIndexed = this._abiCoder.decode(nonIndexed, data, true); let result = []; let nonIndexedIndex = 0, indexedIndex = 0; eventFragment.inputs.forEach((param, index) => { if (param.indexed) { if (resultIndexed == null) { result[index] = new Indexed({ _isIndexed: true, hash: null }); } else if (dynamic[index]) { result[index] = new Indexed({ _isIndexed: true, hash: resultIndexed[indexedIndex++] }); } else { try { result[index] = resultIndexed[indexedIndex++]; } catch (error) { result[index] = error; } } } else { try { result[index] = resultNonIndexed[nonIndexedIndex++]; } catch (error) { result[index] = error; } } // Add the keyword argument if named and safe if (param.name && result[param.name] == null) { const value = result[index]; // Make error named values throw on access if (value instanceof Error) { Object.defineProperty(result, param.name, { enumerable: true, get: () => { throw wrapAccessError(`property ${JSON.stringify(param.name)}`, value); } }); } else { result[param.name] = value; } } }); // Make all error indexed values throw on access for (let i = 0; i < result.length; i++) { const value = result[i]; if (value instanceof Error) { Object.defineProperty(result, i, { enumerable: true, get: () => { throw wrapAccessError(`index ${i}`, value); } }); } } return Object.freeze(result); } // Given a transaction, find the matching function fragment (if any) and // determine all its properties and call parameters parseTransaction(tx) { let fragment = this.getFunction(tx.data.substring(0, 10).toLowerCase()); if (!fragment) { return null; } return new TransactionDescription({ args: this._abiCoder.decode(fragment.inputs, "0x" + tx.data.substring(10)), functionFragment: fragment, name: fragment.name, signature: fragment.format(), sighash: this.getSighash(fragment), value: _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_9__/* .BigNumber.from */ .O$.from(tx.value || "0"), }); } // @TODO //parseCallResult(data: BytesLike): ?? // Given an event log, find the matching event fragment (if any) and // determine all its properties and values parseLog(log) { let fragment = this.getEvent(log.topics[0]); if (!fragment || fragment.anonymous) { return null; } // @TODO: If anonymous, and the only method, and the input count matches, should we parse? // Probably not, because just because it is the only event in the ABI does // not mean we have the full ABI; maybe just a fragment? return new LogDescription({ eventFragment: fragment, name: fragment.name, signature: fragment.format(), topic: this.getEventTopic(fragment), args: this.decodeEventLog(fragment, log.data, log.topics) }); } parseError(data) { const hexData = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(data); let fragment = this.getError(hexData.substring(0, 10).toLowerCase()); if (!fragment) { return null; } return new ErrorDescription({ args: this._abiCoder.decode(fragment.inputs, "0x" + hexData.substring(10)), errorFragment: fragment, name: fragment.name, signature: fragment.format(), sighash: this.getSighash(fragment), }); } /* static from(value: Array | string | Interface) { if (Interface.isInterface(value)) { return value; } if (typeof(value) === "string") { return new Interface(JSON.parse(value)); } return new Interface(value); } */ static isInterface(value) { return !!(value && value._isInterface); } } //# sourceMappingURL=interface.js.map /***/ }), /***/ 81556: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { "BlockForkEvent": function() { return /* binding */ BlockForkEvent; }, "ForkEvent": function() { return /* binding */ ForkEvent; }, "Provider": function() { return /* binding */ Provider; }, "TransactionForkEvent": function() { return /* binding */ TransactionForkEvent; }, "TransactionOrderForkEvent": function() { return /* binding */ TransactionOrderForkEvent; } }); // EXTERNAL MODULE: ./node_modules/@ethersproject/bignumber/lib.esm/bignumber.js var bignumber = __webpack_require__(2593); // EXTERNAL MODULE: ./node_modules/@ethersproject/bytes/lib.esm/index.js + 1 modules var lib_esm = __webpack_require__(16441); // EXTERNAL MODULE: ./node_modules/@ethersproject/properties/lib.esm/index.js + 1 modules var properties_lib_esm = __webpack_require__(6881); // EXTERNAL MODULE: ./node_modules/@ethersproject/logger/lib.esm/index.js + 1 modules var logger_lib_esm = __webpack_require__(1581); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/abstract-provider/lib.esm/_version.js const version = "abstract-provider/5.6.1"; //# sourceMappingURL=_version.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/abstract-provider/lib.esm/index.js var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; const logger = new logger_lib_esm.Logger(version); ; ; //export type CallTransactionable = { // call(transaction: TransactionRequest): Promise; //}; class ForkEvent extends properties_lib_esm.Description { static isForkEvent(value) { return !!(value && value._isForkEvent); } } class BlockForkEvent extends ForkEvent { constructor(blockHash, expiry) { if (!(0,lib_esm.isHexString)(blockHash, 32)) { logger.throwArgumentError("invalid blockHash", "blockHash", blockHash); } super({ _isForkEvent: true, _isBlockForkEvent: true, expiry: (expiry || 0), blockHash: blockHash }); } } class TransactionForkEvent extends ForkEvent { constructor(hash, expiry) { if (!(0,lib_esm.isHexString)(hash, 32)) { logger.throwArgumentError("invalid transaction hash", "hash", hash); } super({ _isForkEvent: true, _isTransactionForkEvent: true, expiry: (expiry || 0), hash: hash }); } } class TransactionOrderForkEvent extends ForkEvent { constructor(beforeHash, afterHash, expiry) { if (!(0,lib_esm.isHexString)(beforeHash, 32)) { logger.throwArgumentError("invalid transaction hash", "beforeHash", beforeHash); } if (!(0,lib_esm.isHexString)(afterHash, 32)) { logger.throwArgumentError("invalid transaction hash", "afterHash", afterHash); } super({ _isForkEvent: true, _isTransactionOrderForkEvent: true, expiry: (expiry || 0), beforeHash: beforeHash, afterHash: afterHash }); } } /////////////////////////////// // Exported Abstracts class Provider { constructor() { logger.checkAbstract(new.target, Provider); (0,properties_lib_esm.defineReadOnly)(this, "_isProvider", true); } getFeeData() { return __awaiter(this, void 0, void 0, function* () { const { block, gasPrice } = yield (0,properties_lib_esm.resolveProperties)({ block: this.getBlock("latest"), gasPrice: this.getGasPrice().catch((error) => { // @TODO: Why is this now failing on Calaveras? //console.log(error); return null; }) }); let maxFeePerGas = null, maxPriorityFeePerGas = null; if (block && block.baseFeePerGas) { // We may want to compute this more accurately in the future, // using the formula "check if the base fee is correct". // See: https://eips.ethereum.org/EIPS/eip-1559 maxPriorityFeePerGas = bignumber/* BigNumber.from */.O$.from("1500000000"); maxFeePerGas = block.baseFeePerGas.mul(2).add(maxPriorityFeePerGas); } return { maxFeePerGas, maxPriorityFeePerGas, gasPrice }; }); } // Alias for "on" addListener(eventName, listener) { return this.on(eventName, listener); } // Alias for "off" removeListener(eventName, listener) { return this.off(eventName, listener); } static isProvider(value) { return !!(value && value._isProvider); } } //# sourceMappingURL=index.js.map /***/ }), /***/ 48088: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { "Signer": function() { return /* binding */ Signer; }, "VoidSigner": function() { return /* binding */ VoidSigner; } }); // EXTERNAL MODULE: ./node_modules/@ethersproject/properties/lib.esm/index.js + 1 modules var lib_esm = __webpack_require__(6881); // EXTERNAL MODULE: ./node_modules/@ethersproject/logger/lib.esm/index.js + 1 modules var logger_lib_esm = __webpack_require__(1581); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/abstract-signer/lib.esm/_version.js const version = "abstract-signer/5.6.2"; //# sourceMappingURL=_version.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/abstract-signer/lib.esm/index.js var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; const logger = new logger_lib_esm.Logger(version); const allowedTransactionKeys = [ "accessList", "ccipReadEnabled", "chainId", "customData", "data", "from", "gasLimit", "gasPrice", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "to", "type", "value" ]; const forwardErrors = [ logger_lib_esm.Logger.errors.INSUFFICIENT_FUNDS, logger_lib_esm.Logger.errors.NONCE_EXPIRED, logger_lib_esm.Logger.errors.REPLACEMENT_UNDERPRICED, ]; ; ; class Signer { /////////////////// // Sub-classes MUST call super constructor() { logger.checkAbstract(new.target, Signer); (0,lib_esm.defineReadOnly)(this, "_isSigner", true); } /////////////////// // Sub-classes MAY override these getBalance(blockTag) { return __awaiter(this, void 0, void 0, function* () { this._checkProvider("getBalance"); return yield this.provider.getBalance(this.getAddress(), blockTag); }); } getTransactionCount(blockTag) { return __awaiter(this, void 0, void 0, function* () { this._checkProvider("getTransactionCount"); return yield this.provider.getTransactionCount(this.getAddress(), blockTag); }); } // Populates "from" if unspecified, and estimates the gas for the transaction estimateGas(transaction) { return __awaiter(this, void 0, void 0, function* () { this._checkProvider("estimateGas"); const tx = yield (0,lib_esm.resolveProperties)(this.checkTransaction(transaction)); return yield this.provider.estimateGas(tx); }); } // Populates "from" if unspecified, and calls with the transaction call(transaction, blockTag) { return __awaiter(this, void 0, void 0, function* () { this._checkProvider("call"); const tx = yield (0,lib_esm.resolveProperties)(this.checkTransaction(transaction)); return yield this.provider.call(tx, blockTag); }); } // Populates all fields in a transaction, signs it and sends it to the network sendTransaction(transaction) { return __awaiter(this, void 0, void 0, function* () { this._checkProvider("sendTransaction"); const tx = yield this.populateTransaction(transaction); const signedTx = yield this.signTransaction(tx); return yield this.provider.sendTransaction(signedTx); }); } getChainId() { return __awaiter(this, void 0, void 0, function* () { this._checkProvider("getChainId"); const network = yield this.provider.getNetwork(); return network.chainId; }); } getGasPrice() { return __awaiter(this, void 0, void 0, function* () { this._checkProvider("getGasPrice"); return yield this.provider.getGasPrice(); }); } getFeeData() { return __awaiter(this, void 0, void 0, function* () { this._checkProvider("getFeeData"); return yield this.provider.getFeeData(); }); } resolveName(name) { return __awaiter(this, void 0, void 0, function* () { this._checkProvider("resolveName"); return yield this.provider.resolveName(name); }); } // Checks a transaction does not contain invalid keys and if // no "from" is provided, populates it. // - does NOT require a provider // - adds "from" is not present // - returns a COPY (safe to mutate the result) // By default called from: (overriding these prevents it) // - call // - estimateGas // - populateTransaction (and therefor sendTransaction) checkTransaction(transaction) { for (const key in transaction) { if (allowedTransactionKeys.indexOf(key) === -1) { logger.throwArgumentError("invalid transaction key: " + key, "transaction", transaction); } } const tx = (0,lib_esm.shallowCopy)(transaction); if (tx.from == null) { tx.from = this.getAddress(); } else { // Make sure any provided address matches this signer tx.from = Promise.all([ Promise.resolve(tx.from), this.getAddress() ]).then((result) => { if (result[0].toLowerCase() !== result[1].toLowerCase()) { logger.throwArgumentError("from address mismatch", "transaction", transaction); } return result[0]; }); } return tx; } // Populates ALL keys for a transaction and checks that "from" matches // this Signer. Should be used by sendTransaction but NOT by signTransaction. // By default called from: (overriding these prevents it) // - sendTransaction // // Notes: // - We allow gasPrice for EIP-1559 as long as it matches maxFeePerGas populateTransaction(transaction) { return __awaiter(this, void 0, void 0, function* () { const tx = yield (0,lib_esm.resolveProperties)(this.checkTransaction(transaction)); if (tx.to != null) { tx.to = Promise.resolve(tx.to).then((to) => __awaiter(this, void 0, void 0, function* () { if (to == null) { return null; } const address = yield this.resolveName(to); if (address == null) { logger.throwArgumentError("provided ENS name resolves to null", "tx.to", to); } return address; })); // Prevent this error from causing an UnhandledPromiseException tx.to.catch((error) => { }); } // Do not allow mixing pre-eip-1559 and eip-1559 properties const hasEip1559 = (tx.maxFeePerGas != null || tx.maxPriorityFeePerGas != null); if (tx.gasPrice != null && (tx.type === 2 || hasEip1559)) { logger.throwArgumentError("eip-1559 transaction do not support gasPrice", "transaction", transaction); } else if ((tx.type === 0 || tx.type === 1) && hasEip1559) { logger.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas", "transaction", transaction); } if ((tx.type === 2 || tx.type == null) && (tx.maxFeePerGas != null && tx.maxPriorityFeePerGas != null)) { // Fully-formed EIP-1559 transaction (skip getFeeData) tx.type = 2; } else if (tx.type === 0 || tx.type === 1) { // Explicit Legacy or EIP-2930 transaction // Populate missing gasPrice if (tx.gasPrice == null) { tx.gasPrice = this.getGasPrice(); } } else { // We need to get fee data to determine things const feeData = yield this.getFeeData(); if (tx.type == null) { // We need to auto-detect the intended type of this transaction... if (feeData.maxFeePerGas != null && feeData.maxPriorityFeePerGas != null) { // The network supports EIP-1559! // Upgrade transaction from null to eip-1559 tx.type = 2; if (tx.gasPrice != null) { // Using legacy gasPrice property on an eip-1559 network, // so use gasPrice as both fee properties const gasPrice = tx.gasPrice; delete tx.gasPrice; tx.maxFeePerGas = gasPrice; tx.maxPriorityFeePerGas = gasPrice; } else { // Populate missing fee data if (tx.maxFeePerGas == null) { tx.maxFeePerGas = feeData.maxFeePerGas; } if (tx.maxPriorityFeePerGas == null) { tx.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; } } } else if (feeData.gasPrice != null) { // Network doesn't support EIP-1559... // ...but they are trying to use EIP-1559 properties if (hasEip1559) { logger.throwError("network does not support EIP-1559", logger_lib_esm.Logger.errors.UNSUPPORTED_OPERATION, { operation: "populateTransaction" }); } // Populate missing fee data if (tx.gasPrice == null) { tx.gasPrice = feeData.gasPrice; } // Explicitly set untyped transaction to legacy tx.type = 0; } else { // getFeeData has failed us. logger.throwError("failed to get consistent fee data", logger_lib_esm.Logger.errors.UNSUPPORTED_OPERATION, { operation: "signer.getFeeData" }); } } else if (tx.type === 2) { // Explicitly using EIP-1559 // Populate missing fee data if (tx.maxFeePerGas == null) { tx.maxFeePerGas = feeData.maxFeePerGas; } if (tx.maxPriorityFeePerGas == null) { tx.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; } } } if (tx.nonce == null) { tx.nonce = this.getTransactionCount("pending"); } if (tx.gasLimit == null) { tx.gasLimit = this.estimateGas(tx).catch((error) => { if (forwardErrors.indexOf(error.code) >= 0) { throw error; } return logger.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", logger_lib_esm.Logger.errors.UNPREDICTABLE_GAS_LIMIT, { error: error, tx: tx }); }); } if (tx.chainId == null) { tx.chainId = this.getChainId(); } else { tx.chainId = Promise.all([ Promise.resolve(tx.chainId), this.getChainId() ]).then((results) => { if (results[1] !== 0 && results[0] !== results[1]) { logger.throwArgumentError("chainId address mismatch", "transaction", transaction); } return results[0]; }); } return yield (0,lib_esm.resolveProperties)(tx); }); } /////////////////// // Sub-classes SHOULD leave these alone _checkProvider(operation) { if (!this.provider) { logger.throwError("missing provider", logger_lib_esm.Logger.errors.UNSUPPORTED_OPERATION, { operation: (operation || "_checkProvider") }); } } static isSigner(value) { return !!(value && value._isSigner); } } class VoidSigner extends Signer { constructor(address, provider) { super(); (0,lib_esm.defineReadOnly)(this, "address", address); (0,lib_esm.defineReadOnly)(this, "provider", provider || null); } getAddress() { return Promise.resolve(this.address); } _fail(message, operation) { return Promise.resolve().then(() => { logger.throwError(message, logger_lib_esm.Logger.errors.UNSUPPORTED_OPERATION, { operation: operation }); }); } signMessage(message) { return this._fail("VoidSigner cannot sign messages", "signMessage"); } signTransaction(transaction) { return this._fail("VoidSigner cannot sign transactions", "signTransaction"); } _signTypedData(domain, types, value) { return this._fail("VoidSigner cannot sign typed data", "signTypedData"); } connect(provider) { return new VoidSigner(this.address, provider); } } //# sourceMappingURL=index.js.map /***/ }), /***/ 19485: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { "getAddress": function() { return /* binding */ getAddress; }, "getContractAddress": function() { return /* binding */ getContractAddress; }, "getCreate2Address": function() { return /* binding */ getCreate2Address; }, "getIcapAddress": function() { return /* binding */ getIcapAddress; }, "isAddress": function() { return /* binding */ isAddress; } }); // EXTERNAL MODULE: ./node_modules/@ethersproject/bytes/lib.esm/index.js + 1 modules var lib_esm = __webpack_require__(16441); // EXTERNAL MODULE: ./node_modules/@ethersproject/bignumber/lib.esm/bignumber.js var bignumber = __webpack_require__(2593); // EXTERNAL MODULE: ./node_modules/@ethersproject/keccak256/lib.esm/index.js var keccak256_lib_esm = __webpack_require__(38197); // EXTERNAL MODULE: ./node_modules/@ethersproject/rlp/lib.esm/index.js + 1 modules var rlp_lib_esm = __webpack_require__(59052); // EXTERNAL MODULE: ./node_modules/@ethersproject/logger/lib.esm/index.js + 1 modules var logger_lib_esm = __webpack_require__(1581); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/address/lib.esm/_version.js const version = "address/5.6.1"; //# sourceMappingURL=_version.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/address/lib.esm/index.js const logger = new logger_lib_esm.Logger(version); function getChecksumAddress(address) { if (!(0,lib_esm.isHexString)(address, 20)) { logger.throwArgumentError("invalid address", "address", address); } address = address.toLowerCase(); const chars = address.substring(2).split(""); const expanded = new Uint8Array(40); for (let i = 0; i < 40; i++) { expanded[i] = chars[i].charCodeAt(0); } const hashed = (0,lib_esm.arrayify)((0,keccak256_lib_esm.keccak256)(expanded)); for (let i = 0; i < 40; i += 2) { if ((hashed[i >> 1] >> 4) >= 8) { chars[i] = chars[i].toUpperCase(); } if ((hashed[i >> 1] & 0x0f) >= 8) { chars[i + 1] = chars[i + 1].toUpperCase(); } } return "0x" + chars.join(""); } // Shims for environments that are missing some required constants and functions const MAX_SAFE_INTEGER = 0x1fffffffffffff; function log10(x) { if (Math.log10) { return Math.log10(x); } return Math.log(x) / Math.LN10; } // See: https://en.wikipedia.org/wiki/International_Bank_Account_Number // Create lookup table const ibanLookup = {}; for (let i = 0; i < 10; i++) { ibanLookup[String(i)] = String(i); } for (let i = 0; i < 26; i++) { ibanLookup[String.fromCharCode(65 + i)] = String(10 + i); } // How many decimal digits can we process? (for 64-bit float, this is 15) const safeDigits = Math.floor(log10(MAX_SAFE_INTEGER)); function ibanChecksum(address) { address = address.toUpperCase(); address = address.substring(4) + address.substring(0, 2) + "00"; let expanded = address.split("").map((c) => { return ibanLookup[c]; }).join(""); // Javascript can handle integers safely up to 15 (decimal) digits while (expanded.length >= safeDigits) { let block = expanded.substring(0, safeDigits); expanded = parseInt(block, 10) % 97 + expanded.substring(block.length); } let checksum = String(98 - (parseInt(expanded, 10) % 97)); while (checksum.length < 2) { checksum = "0" + checksum; } return checksum; } ; function getAddress(address) { let result = null; if (typeof (address) !== "string") { logger.throwArgumentError("invalid address", "address", address); } if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) { // Missing the 0x prefix if (address.substring(0, 2) !== "0x") { address = "0x" + address; } result = getChecksumAddress(address); // It is a checksummed address with a bad checksum if (address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && result !== address) { logger.throwArgumentError("bad address checksum", "address", address); } // Maybe ICAP? (we only support direct mode) } else if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) { // It is an ICAP address with a bad checksum if (address.substring(2, 4) !== ibanChecksum(address)) { logger.throwArgumentError("bad icap checksum", "address", address); } result = (0,bignumber/* _base36To16 */.g$)(address.substring(4)); while (result.length < 40) { result = "0" + result; } result = getChecksumAddress("0x" + result); } else { logger.throwArgumentError("invalid address", "address", address); } return result; } function isAddress(address) { try { getAddress(address); return true; } catch (error) { } return false; } function getIcapAddress(address) { let base36 = (0,bignumber/* _base16To36 */.t2)(getAddress(address).substring(2)).toUpperCase(); while (base36.length < 30) { base36 = "0" + base36; } return "XE" + ibanChecksum("XE00" + base36) + base36; } // http://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed function getContractAddress(transaction) { let from = null; try { from = getAddress(transaction.from); } catch (error) { logger.throwArgumentError("missing from address", "transaction", transaction); } const nonce = (0,lib_esm.stripZeros)((0,lib_esm.arrayify)(bignumber/* BigNumber.from */.O$.from(transaction.nonce).toHexString())); return getAddress((0,lib_esm.hexDataSlice)((0,keccak256_lib_esm.keccak256)((0,rlp_lib_esm.encode)([from, nonce])), 12)); } function getCreate2Address(from, salt, initCodeHash) { if ((0,lib_esm.hexDataLength)(salt) !== 32) { logger.throwArgumentError("salt must be 32 bytes", "salt", salt); } if ((0,lib_esm.hexDataLength)(initCodeHash) !== 32) { logger.throwArgumentError("initCodeHash must be 32 bytes", "initCodeHash", initCodeHash); } return getAddress((0,lib_esm.hexDataSlice)((0,keccak256_lib_esm.keccak256)((0,lib_esm.concat)(["0xff", getAddress(from), salt, initCodeHash])), 12)); } //# sourceMappingURL=index.js.map /***/ }), /***/ 59567: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "J": function() { return /* binding */ decode; }, /* harmony export */ "c": function() { return /* binding */ encode; } /* harmony export */ }); /* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16441); function decode(textData) { textData = atob(textData); const data = []; for (let i = 0; i < textData.length; i++) { data.push(textData.charCodeAt(i)); } return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.arrayify)(data); } function encode(data) { data = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.arrayify)(data); let textData = ""; for (let i = 0; i < data.length; i++) { textData += String.fromCharCode(data[i]); } return btoa(textData); } //# sourceMappingURL=base64.js.map /***/ }), /***/ 4089: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "decode": function() { return /* reexport safe */ _base64__WEBPACK_IMPORTED_MODULE_0__.J; }, /* harmony export */ "encode": function() { return /* reexport safe */ _base64__WEBPACK_IMPORTED_MODULE_0__.c; } /* harmony export */ }); /* harmony import */ var _base64__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(59567); //# sourceMappingURL=index.js.map /***/ }), /***/ 57727: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Base32": function() { return /* binding */ Base32; }, /* harmony export */ "Base58": function() { return /* binding */ Base58; }, /* harmony export */ "BaseX": function() { return /* binding */ BaseX; } /* harmony export */ }); /* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16441); /* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6881); /** * var basex = require("base-x"); * * This implementation is heavily based on base-x. The main reason to * deviate was to prevent the dependency of Buffer. * * Contributors: * * base-x encoding * Forked from https://github.com/cryptocoinjs/bs58 * Originally written by Mike Hearn for BitcoinJ * Copyright (c) 2011 Google Inc * Ported to JavaScript by Stefan Thomas * Merged Buffer refactorings from base58-native by Stephen Pair * Copyright (c) 2013 BitPay Inc * * The MIT License (MIT) * * Copyright base-x contributors (c) 2016 * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * */ class BaseX { constructor(alphabet) { (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__.defineReadOnly)(this, "alphabet", alphabet); (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__.defineReadOnly)(this, "base", alphabet.length); (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__.defineReadOnly)(this, "_alphabetMap", {}); (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__.defineReadOnly)(this, "_leader", alphabet.charAt(0)); // pre-compute lookup table for (let i = 0; i < alphabet.length; i++) { this._alphabetMap[alphabet.charAt(i)] = i; } } encode(value) { let source = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__.arrayify)(value); if (source.length === 0) { return ""; } let digits = [0]; for (let i = 0; i < source.length; ++i) { let carry = source[i]; for (let j = 0; j < digits.length; ++j) { carry += digits[j] << 8; digits[j] = carry % this.base; carry = (carry / this.base) | 0; } while (carry > 0) { digits.push(carry % this.base); carry = (carry / this.base) | 0; } } let string = ""; // deal with leading zeros for (let k = 0; source[k] === 0 && k < source.length - 1; ++k) { string += this._leader; } // convert digits to a string for (let q = digits.length - 1; q >= 0; --q) { string += this.alphabet[digits[q]]; } return string; } decode(value) { if (typeof (value) !== "string") { throw new TypeError("Expected String"); } let bytes = []; if (value.length === 0) { return new Uint8Array(bytes); } bytes.push(0); for (let i = 0; i < value.length; i++) { let byte = this._alphabetMap[value[i]]; if (byte === undefined) { throw new Error("Non-base" + this.base + " character"); } let carry = byte; for (let j = 0; j < bytes.length; ++j) { carry += bytes[j] * this.base; bytes[j] = carry & 0xff; carry >>= 8; } while (carry > 0) { bytes.push(carry & 0xff); carry >>= 8; } } // deal with leading zeros for (let k = 0; value[k] === this._leader && k < value.length - 1; ++k) { bytes.push(0); } return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__.arrayify)(new Uint8Array(bytes.reverse())); } } const Base32 = new BaseX("abcdefghijklmnopqrstuvwxyz234567"); const Base58 = new BaseX("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"); //console.log(Base58.decode("Qmd2V777o5XvJbYMeMb8k2nU5f8d3ciUQ5YpYuWhzv8iDj")) //console.log(Base58.encode(Base58.decode("Qmd2V777o5XvJbYMeMb8k2nU5f8d3ciUQ5YpYuWhzv8iDj"))) //# sourceMappingURL=index.js.map /***/ }), /***/ 48794: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "i": function() { return /* binding */ version; } /* harmony export */ }); const version = "bignumber/5.6.2"; //# sourceMappingURL=_version.js.map /***/ }), /***/ 2593: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "O$": function() { return /* binding */ BigNumber; }, /* harmony export */ "Zm": function() { return /* binding */ isBigNumberish; }, /* harmony export */ "g$": function() { return /* binding */ _base36To16; }, /* harmony export */ "t2": function() { return /* binding */ _base16To36; } /* harmony export */ }); /* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(83877); /* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(bn_js__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(16441); /* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1581); /* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(48794); /** * BigNumber * * A wrapper around the BN.js object. We use the BN.js library * because it is used by elliptic, so it is required regardless. * */ var BN = (bn_js__WEBPACK_IMPORTED_MODULE_0___default().BN); const logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger(_version__WEBPACK_IMPORTED_MODULE_2__/* .version */ .i); const _constructorGuard = {}; const MAX_SAFE = 0x1fffffffffffff; function isBigNumberish(value) { return (value != null) && (BigNumber.isBigNumber(value) || (typeof (value) === "number" && (value % 1) === 0) || (typeof (value) === "string" && !!value.match(/^-?[0-9]+$/)) || (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isHexString)(value) || (typeof (value) === "bigint") || (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isBytes)(value)); } // Only warn about passing 10 into radix once let _warnedToStringRadix = false; class BigNumber { constructor(constructorGuard, hex) { if (constructorGuard !== _constructorGuard) { logger.throwError("cannot call constructor directly; use BigNumber.from", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNSUPPORTED_OPERATION, { operation: "new (BigNumber)" }); } this._hex = hex; this._isBigNumber = true; Object.freeze(this); } fromTwos(value) { return toBigNumber(toBN(this).fromTwos(value)); } toTwos(value) { return toBigNumber(toBN(this).toTwos(value)); } abs() { if (this._hex[0] === "-") { return BigNumber.from(this._hex.substring(1)); } return this; } add(other) { return toBigNumber(toBN(this).add(toBN(other))); } sub(other) { return toBigNumber(toBN(this).sub(toBN(other))); } div(other) { const o = BigNumber.from(other); if (o.isZero()) { throwFault("division-by-zero", "div"); } return toBigNumber(toBN(this).div(toBN(other))); } mul(other) { return toBigNumber(toBN(this).mul(toBN(other))); } mod(other) { const value = toBN(other); if (value.isNeg()) { throwFault("division-by-zero", "mod"); } return toBigNumber(toBN(this).umod(value)); } pow(other) { const value = toBN(other); if (value.isNeg()) { throwFault("negative-power", "pow"); } return toBigNumber(toBN(this).pow(value)); } and(other) { const value = toBN(other); if (this.isNegative() || value.isNeg()) { throwFault("unbound-bitwise-result", "and"); } return toBigNumber(toBN(this).and(value)); } or(other) { const value = toBN(other); if (this.isNegative() || value.isNeg()) { throwFault("unbound-bitwise-result", "or"); } return toBigNumber(toBN(this).or(value)); } xor(other) { const value = toBN(other); if (this.isNegative() || value.isNeg()) { throwFault("unbound-bitwise-result", "xor"); } return toBigNumber(toBN(this).xor(value)); } mask(value) { if (this.isNegative() || value < 0) { throwFault("negative-width", "mask"); } return toBigNumber(toBN(this).maskn(value)); } shl(value) { if (this.isNegative() || value < 0) { throwFault("negative-width", "shl"); } return toBigNumber(toBN(this).shln(value)); } shr(value) { if (this.isNegative() || value < 0) { throwFault("negative-width", "shr"); } return toBigNumber(toBN(this).shrn(value)); } eq(other) { return toBN(this).eq(toBN(other)); } lt(other) { return toBN(this).lt(toBN(other)); } lte(other) { return toBN(this).lte(toBN(other)); } gt(other) { return toBN(this).gt(toBN(other)); } gte(other) { return toBN(this).gte(toBN(other)); } isNegative() { return (this._hex[0] === "-"); } isZero() { return toBN(this).isZero(); } toNumber() { try { return toBN(this).toNumber(); } catch (error) { throwFault("overflow", "toNumber", this.toString()); } return null; } toBigInt() { try { return BigInt(this.toString()); } catch (e) { } return logger.throwError("this platform does not support BigInt", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNSUPPORTED_OPERATION, { value: this.toString() }); } toString() { // Lots of people expect this, which we do not support, so check (See: #889) if (arguments.length > 0) { if (arguments[0] === 10) { if (!_warnedToStringRadix) { _warnedToStringRadix = true; logger.warn("BigNumber.toString does not accept any parameters; base-10 is assumed"); } } else if (arguments[0] === 16) { logger.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNEXPECTED_ARGUMENT, {}); } else { logger.throwError("BigNumber.toString does not accept parameters", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNEXPECTED_ARGUMENT, {}); } } return toBN(this).toString(10); } toHexString() { return this._hex; } toJSON(key) { return { type: "BigNumber", hex: this.toHexString() }; } static from(value) { if (value instanceof BigNumber) { return value; } if (typeof (value) === "string") { if (value.match(/^-?0x[0-9a-f]+$/i)) { return new BigNumber(_constructorGuard, toHex(value)); } if (value.match(/^-?[0-9]+$/)) { return new BigNumber(_constructorGuard, toHex(new BN(value))); } return logger.throwArgumentError("invalid BigNumber string", "value", value); } if (typeof (value) === "number") { if (value % 1) { throwFault("underflow", "BigNumber.from", value); } if (value >= MAX_SAFE || value <= -MAX_SAFE) { throwFault("overflow", "BigNumber.from", value); } return BigNumber.from(String(value)); } const anyValue = value; if (typeof (anyValue) === "bigint") { return BigNumber.from(anyValue.toString()); } if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isBytes)(anyValue)) { return BigNumber.from((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexlify)(anyValue)); } if (anyValue) { // Hexable interface (takes priority) if (anyValue.toHexString) { const hex = anyValue.toHexString(); if (typeof (hex) === "string") { return BigNumber.from(hex); } } else { // For now, handle legacy JSON-ified values (goes away in v6) let hex = anyValue._hex; // New-form JSON if (hex == null && anyValue.type === "BigNumber") { hex = anyValue.hex; } if (typeof (hex) === "string") { if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isHexString)(hex) || (hex[0] === "-" && (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isHexString)(hex.substring(1)))) { return BigNumber.from(hex); } } } } return logger.throwArgumentError("invalid BigNumber value", "value", value); } static isBigNumber(value) { return !!(value && value._isBigNumber); } } // Normalize the hex string function toHex(value) { // For BN, call on the hex string if (typeof (value) !== "string") { return toHex(value.toString(16)); } // If negative, prepend the negative sign to the normalized positive value if (value[0] === "-") { // Strip off the negative sign value = value.substring(1); // Cannot have multiple negative signs (e.g. "--0x04") if (value[0] === "-") { logger.throwArgumentError("invalid hex", "value", value); } // Call toHex on the positive component value = toHex(value); // Do not allow "-0x00" if (value === "0x00") { return value; } // Negate the value return "-" + value; } // Add a "0x" prefix if missing if (value.substring(0, 2) !== "0x") { value = "0x" + value; } // Normalize zero if (value === "0x") { return "0x00"; } // Make the string even length if (value.length % 2) { value = "0x0" + value.substring(2); } // Trim to smallest even-length string while (value.length > 4 && value.substring(0, 4) === "0x00") { value = "0x" + value.substring(4); } return value; } function toBigNumber(value) { return BigNumber.from(toHex(value)); } function toBN(value) { const hex = BigNumber.from(value).toHexString(); if (hex[0] === "-") { return (new BN("-" + hex.substring(3), 16)); } return new BN(hex.substring(2), 16); } function throwFault(fault, operation, value) { const params = { fault: fault, operation: operation }; if (value != null) { params.value = value; } return logger.throwError(fault, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.NUMERIC_FAULT, params); } // value should have no prefix function _base36To16(value) { return (new BN(value, 36)).toString(16); } // value should have no prefix function _base16To36(value) { return (new BN(value, 16)).toString(36); } //# sourceMappingURL=bignumber.js.map /***/ }), /***/ 20335: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Ox": function() { return /* binding */ parseFixed; }, /* harmony export */ "S5": function() { return /* binding */ formatFixed; }, /* harmony export */ "xO": function() { return /* binding */ FixedFormat; }, /* harmony export */ "xs": function() { return /* binding */ FixedNumber; } /* harmony export */ }); /* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(16441); /* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1581); /* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(48794); /* harmony import */ var _bignumber__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2593); const logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__/* .version */ .i); const _constructorGuard = {}; const Zero = _bignumber__WEBPACK_IMPORTED_MODULE_2__/* .BigNumber.from */ .O$.from(0); const NegativeOne = _bignumber__WEBPACK_IMPORTED_MODULE_2__/* .BigNumber.from */ .O$.from(-1); function throwFault(message, fault, operation, value) { const params = { fault: fault, operation: operation }; if (value !== undefined) { params.value = value; } return logger.throwError(message, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.NUMERIC_FAULT, params); } // Constant to pull zeros from for multipliers let zeros = "0"; while (zeros.length < 256) { zeros += zeros; } // Returns a string "1" followed by decimal "0"s function getMultiplier(decimals) { if (typeof (decimals) !== "number") { try { decimals = _bignumber__WEBPACK_IMPORTED_MODULE_2__/* .BigNumber.from */ .O$.from(decimals).toNumber(); } catch (e) { } } if (typeof (decimals) === "number" && decimals >= 0 && decimals <= 256 && !(decimals % 1)) { return ("1" + zeros.substring(0, decimals)); } return logger.throwArgumentError("invalid decimal size", "decimals", decimals); } function formatFixed(value, decimals) { if (decimals == null) { decimals = 0; } const multiplier = getMultiplier(decimals); // Make sure wei is a big number (convert as necessary) value = _bignumber__WEBPACK_IMPORTED_MODULE_2__/* .BigNumber.from */ .O$.from(value); const negative = value.lt(Zero); if (negative) { value = value.mul(NegativeOne); } let fraction = value.mod(multiplier).toString(); while (fraction.length < multiplier.length - 1) { fraction = "0" + fraction; } // Strip training 0 fraction = fraction.match(/^([0-9]*[1-9]|0)(0*)/)[1]; const whole = value.div(multiplier).toString(); if (multiplier.length === 1) { value = whole; } else { value = whole + "." + fraction; } if (negative) { value = "-" + value; } return value; } function parseFixed(value, decimals) { if (decimals == null) { decimals = 0; } const multiplier = getMultiplier(decimals); if (typeof (value) !== "string" || !value.match(/^-?[0-9.]+$/)) { logger.throwArgumentError("invalid decimal value", "value", value); } // Is it negative? const negative = (value.substring(0, 1) === "-"); if (negative) { value = value.substring(1); } if (value === ".") { logger.throwArgumentError("missing value", "value", value); } // Split it into a whole and fractional part const comps = value.split("."); if (comps.length > 2) { logger.throwArgumentError("too many decimal points", "value", value); } let whole = comps[0], fraction = comps[1]; if (!whole) { whole = "0"; } if (!fraction) { fraction = "0"; } // Trim trailing zeros while (fraction[fraction.length - 1] === "0") { fraction = fraction.substring(0, fraction.length - 1); } // Check the fraction doesn't exceed our decimals size if (fraction.length > multiplier.length - 1) { throwFault("fractional component exceeds decimals", "underflow", "parseFixed"); } // If decimals is 0, we have an empty string for fraction if (fraction === "") { fraction = "0"; } // Fully pad the string with zeros to get to wei while (fraction.length < multiplier.length - 1) { fraction += "0"; } const wholeValue = _bignumber__WEBPACK_IMPORTED_MODULE_2__/* .BigNumber.from */ .O$.from(whole); const fractionValue = _bignumber__WEBPACK_IMPORTED_MODULE_2__/* .BigNumber.from */ .O$.from(fraction); let wei = (wholeValue.mul(multiplier)).add(fractionValue); if (negative) { wei = wei.mul(NegativeOne); } return wei; } class FixedFormat { constructor(constructorGuard, signed, width, decimals) { if (constructorGuard !== _constructorGuard) { logger.throwError("cannot use FixedFormat constructor; use FixedFormat.from", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.UNSUPPORTED_OPERATION, { operation: "new FixedFormat" }); } this.signed = signed; this.width = width; this.decimals = decimals; this.name = (signed ? "" : "u") + "fixed" + String(width) + "x" + String(decimals); this._multiplier = getMultiplier(decimals); Object.freeze(this); } static from(value) { if (value instanceof FixedFormat) { return value; } if (typeof (value) === "number") { value = `fixed128x${value}`; } let signed = true; let width = 128; let decimals = 18; if (typeof (value) === "string") { if (value === "fixed") { // defaults... } else if (value === "ufixed") { signed = false; } else { const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/); if (!match) { logger.throwArgumentError("invalid fixed format", "format", value); } signed = (match[1] !== "u"); width = parseInt(match[2]); decimals = parseInt(match[3]); } } else if (value) { const check = (key, type, defaultValue) => { if (value[key] == null) { return defaultValue; } if (typeof (value[key]) !== type) { logger.throwArgumentError("invalid fixed format (" + key + " not " + type + ")", "format." + key, value[key]); } return value[key]; }; signed = check("signed", "boolean", signed); width = check("width", "number", width); decimals = check("decimals", "number", decimals); } if (width % 8) { logger.throwArgumentError("invalid fixed format width (not byte aligned)", "format.width", width); } if (decimals > 80) { logger.throwArgumentError("invalid fixed format (decimals too large)", "format.decimals", decimals); } return new FixedFormat(_constructorGuard, signed, width, decimals); } } class FixedNumber { constructor(constructorGuard, hex, value, format) { if (constructorGuard !== _constructorGuard) { logger.throwError("cannot use FixedNumber constructor; use FixedNumber.from", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.UNSUPPORTED_OPERATION, { operation: "new FixedFormat" }); } this.format = format; this._hex = hex; this._value = value; this._isFixedNumber = true; Object.freeze(this); } _checkFormat(other) { if (this.format.name !== other.format.name) { logger.throwArgumentError("incompatible format; use fixedNumber.toFormat", "other", other); } } addUnsafe(other) { this._checkFormat(other); const a = parseFixed(this._value, this.format.decimals); const b = parseFixed(other._value, other.format.decimals); return FixedNumber.fromValue(a.add(b), this.format.decimals, this.format); } subUnsafe(other) { this._checkFormat(other); const a = parseFixed(this._value, this.format.decimals); const b = parseFixed(other._value, other.format.decimals); return FixedNumber.fromValue(a.sub(b), this.format.decimals, this.format); } mulUnsafe(other) { this._checkFormat(other); const a = parseFixed(this._value, this.format.decimals); const b = parseFixed(other._value, other.format.decimals); return FixedNumber.fromValue(a.mul(b).div(this.format._multiplier), this.format.decimals, this.format); } divUnsafe(other) { this._checkFormat(other); const a = parseFixed(this._value, this.format.decimals); const b = parseFixed(other._value, other.format.decimals); return FixedNumber.fromValue(a.mul(this.format._multiplier).div(b), this.format.decimals, this.format); } floor() { const comps = this.toString().split("."); if (comps.length === 1) { comps.push("0"); } let result = FixedNumber.from(comps[0], this.format); const hasFraction = !comps[1].match(/^(0*)$/); if (this.isNegative() && hasFraction) { result = result.subUnsafe(ONE.toFormat(result.format)); } return result; } ceiling() { const comps = this.toString().split("."); if (comps.length === 1) { comps.push("0"); } let result = FixedNumber.from(comps[0], this.format); const hasFraction = !comps[1].match(/^(0*)$/); if (!this.isNegative() && hasFraction) { result = result.addUnsafe(ONE.toFormat(result.format)); } return result; } // @TODO: Support other rounding algorithms round(decimals) { if (decimals == null) { decimals = 0; } // If we are already in range, we're done const comps = this.toString().split("."); if (comps.length === 1) { comps.push("0"); } if (decimals < 0 || decimals > 80 || (decimals % 1)) { logger.throwArgumentError("invalid decimal count", "decimals", decimals); } if (comps[1].length <= decimals) { return this; } const factor = FixedNumber.from("1" + zeros.substring(0, decimals), this.format); const bump = BUMP.toFormat(this.format); return this.mulUnsafe(factor).addUnsafe(bump).floor().divUnsafe(factor); } isZero() { return (this._value === "0.0" || this._value === "0"); } isNegative() { return (this._value[0] === "-"); } toString() { return this._value; } toHexString(width) { if (width == null) { return this._hex; } if (width % 8) { logger.throwArgumentError("invalid byte width", "width", width); } const hex = _bignumber__WEBPACK_IMPORTED_MODULE_2__/* .BigNumber.from */ .O$.from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString(); return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexZeroPad)(hex, width / 8); } toUnsafeFloat() { return parseFloat(this.toString()); } toFormat(format) { return FixedNumber.fromString(this._value, format); } static fromValue(value, decimals, format) { // If decimals looks more like a format, and there is no format, shift the parameters if (format == null && decimals != null && !(0,_bignumber__WEBPACK_IMPORTED_MODULE_2__/* .isBigNumberish */ .Zm)(decimals)) { format = decimals; decimals = null; } if (decimals == null) { decimals = 0; } if (format == null) { format = "fixed"; } return FixedNumber.fromString(formatFixed(value, decimals), FixedFormat.from(format)); } static fromString(value, format) { if (format == null) { format = "fixed"; } const fixedFormat = FixedFormat.from(format); const numeric = parseFixed(value, fixedFormat.decimals); if (!fixedFormat.signed && numeric.lt(Zero)) { throwFault("unsigned value cannot be negative", "overflow", "value", value); } let hex = null; if (fixedFormat.signed) { hex = numeric.toTwos(fixedFormat.width).toHexString(); } else { hex = numeric.toHexString(); hex = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexZeroPad)(hex, fixedFormat.width / 8); } const decimal = formatFixed(numeric, fixedFormat.decimals); return new FixedNumber(_constructorGuard, hex, decimal, fixedFormat); } static fromBytes(value, format) { if (format == null) { format = "fixed"; } const fixedFormat = FixedFormat.from(format); if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.arrayify)(value).length > fixedFormat.width / 8) { throw new Error("overflow"); } let numeric = _bignumber__WEBPACK_IMPORTED_MODULE_2__/* .BigNumber.from */ .O$.from(value); if (fixedFormat.signed) { numeric = numeric.fromTwos(fixedFormat.width); } const hex = numeric.toTwos((fixedFormat.signed ? 0 : 1) + fixedFormat.width).toHexString(); const decimal = formatFixed(numeric, fixedFormat.decimals); return new FixedNumber(_constructorGuard, hex, decimal, fixedFormat); } static from(value, format) { if (typeof (value) === "string") { return FixedNumber.fromString(value, format); } if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isBytes)(value)) { return FixedNumber.fromBytes(value, format); } try { return FixedNumber.fromValue(value, 0, format); } catch (error) { // Allow NUMERIC_FAULT to bubble up if (error.code !== _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.INVALID_ARGUMENT) { throw error; } } return logger.throwArgumentError("invalid FixedNumber value", "value", value); } static isFixedNumber(value) { return !!(value && value._isFixedNumber); } } const ONE = FixedNumber.from(1); const BUMP = FixedNumber.from("0.5"); //# sourceMappingURL=fixednumber.js.map /***/ }), /***/ 833: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "BigNumber": function() { return /* reexport safe */ _bignumber__WEBPACK_IMPORTED_MODULE_0__.O$; }, /* harmony export */ "FixedFormat": function() { return /* reexport safe */ _fixednumber__WEBPACK_IMPORTED_MODULE_1__.xO; }, /* harmony export */ "FixedNumber": function() { return /* reexport safe */ _fixednumber__WEBPACK_IMPORTED_MODULE_1__.xs; }, /* harmony export */ "_base16To36": function() { return /* reexport safe */ _bignumber__WEBPACK_IMPORTED_MODULE_0__.t2; }, /* harmony export */ "_base36To16": function() { return /* reexport safe */ _bignumber__WEBPACK_IMPORTED_MODULE_0__.g$; }, /* harmony export */ "formatFixed": function() { return /* reexport safe */ _fixednumber__WEBPACK_IMPORTED_MODULE_1__.S5; }, /* harmony export */ "parseFixed": function() { return /* reexport safe */ _fixednumber__WEBPACK_IMPORTED_MODULE_1__.Ox; } /* harmony export */ }); /* harmony import */ var _bignumber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2593); /* harmony import */ var _fixednumber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(20335); // Internal methods used by address //# sourceMappingURL=index.js.map /***/ }), /***/ 83877: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { /* module decorator */ module = __webpack_require__.nmd(module); (function (module, exports) { 'use strict'; // Utils function assert (val, msg) { if (!val) throw new Error(msg || 'Assertion failed'); } // Could use `inherits` module, but don't want to move from single file // architecture yet. function inherits (ctor, superCtor) { ctor.super_ = superCtor; var TempCtor = function () {}; TempCtor.prototype = superCtor.prototype; ctor.prototype = new TempCtor(); ctor.prototype.constructor = ctor; } // BN function BN (number, base, endian) { if (BN.isBN(number)) { return number; } this.negative = 0; this.words = null; this.length = 0; // Reduction context this.red = null; if (number !== null) { if (base === 'le' || base === 'be') { endian = base; base = 10; } this._init(number || 0, base || 10, endian || 'be'); } } if (typeof module === 'object') { module.exports = BN; } else { exports.BN = BN; } BN.BN = BN; BN.wordSize = 26; var Buffer; try { if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') { Buffer = window.Buffer; } else { Buffer = (__webpack_require__(88677).Buffer); } } catch (e) { } BN.isBN = function isBN (num) { if (num instanceof BN) { return true; } return num !== null && typeof num === 'object' && num.constructor.wordSize === BN.wordSize && Array.isArray(num.words); }; BN.max = function max (left, right) { if (left.cmp(right) > 0) return left; return right; }; BN.min = function min (left, right) { if (left.cmp(right) < 0) return left; return right; }; BN.prototype._init = function init (number, base, endian) { if (typeof number === 'number') { return this._initNumber(number, base, endian); } if (typeof number === 'object') { return this._initArray(number, base, endian); } if (base === 'hex') { base = 16; } assert(base === (base | 0) && base >= 2 && base <= 36); number = number.toString().replace(/\s+/g, ''); var start = 0; if (number[0] === '-') { start++; this.negative = 1; } if (start < number.length) { if (base === 16) { this._parseHex(number, start, endian); } else { this._parseBase(number, base, start); if (endian === 'le') { this._initArray(this.toArray(), base, endian); } } } }; BN.prototype._initNumber = function _initNumber (number, base, endian) { if (number < 0) { this.negative = 1; number = -number; } if (number < 0x4000000) { this.words = [number & 0x3ffffff]; this.length = 1; } else if (number < 0x10000000000000) { this.words = [ number & 0x3ffffff, (number / 0x4000000) & 0x3ffffff ]; this.length = 2; } else { assert(number < 0x20000000000000); // 2 ^ 53 (unsafe) this.words = [ number & 0x3ffffff, (number / 0x4000000) & 0x3ffffff, 1 ]; this.length = 3; } if (endian !== 'le') return; // Reverse the bytes this._initArray(this.toArray(), base, endian); }; BN.prototype._initArray = function _initArray (number, base, endian) { // Perhaps a Uint8Array assert(typeof number.length === 'number'); if (number.length <= 0) { this.words = [0]; this.length = 1; return this; } this.length = Math.ceil(number.length / 3); this.words = new Array(this.length); for (var i = 0; i < this.length; i++) { this.words[i] = 0; } var j, w; var off = 0; if (endian === 'be') { for (i = number.length - 1, j = 0; i >= 0; i -= 3) { w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16); this.words[j] |= (w << off) & 0x3ffffff; this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; off += 24; if (off >= 26) { off -= 26; j++; } } } else if (endian === 'le') { for (i = 0, j = 0; i < number.length; i += 3) { w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16); this.words[j] |= (w << off) & 0x3ffffff; this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; off += 24; if (off >= 26) { off -= 26; j++; } } } return this._strip(); }; function parseHex4Bits (string, index) { var c = string.charCodeAt(index); // '0' - '9' if (c >= 48 && c <= 57) { return c - 48; // 'A' - 'F' } else if (c >= 65 && c <= 70) { return c - 55; // 'a' - 'f' } else if (c >= 97 && c <= 102) { return c - 87; } else { assert(false, 'Invalid character in ' + string); } } function parseHexByte (string, lowerBound, index) { var r = parseHex4Bits(string, index); if (index - 1 >= lowerBound) { r |= parseHex4Bits(string, index - 1) << 4; } return r; } BN.prototype._parseHex = function _parseHex (number, start, endian) { // Create possibly bigger array to ensure that it fits the number this.length = Math.ceil((number.length - start) / 6); this.words = new Array(this.length); for (var i = 0; i < this.length; i++) { this.words[i] = 0; } // 24-bits chunks var off = 0; var j = 0; var w; if (endian === 'be') { for (i = number.length - 1; i >= start; i -= 2) { w = parseHexByte(number, start, i) << off; this.words[j] |= w & 0x3ffffff; if (off >= 18) { off -= 18; j += 1; this.words[j] |= w >>> 26; } else { off += 8; } } } else { var parseLength = number.length - start; for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) { w = parseHexByte(number, start, i) << off; this.words[j] |= w & 0x3ffffff; if (off >= 18) { off -= 18; j += 1; this.words[j] |= w >>> 26; } else { off += 8; } } } this._strip(); }; function parseBase (str, start, end, mul) { var r = 0; var b = 0; var len = Math.min(str.length, end); for (var i = start; i < len; i++) { var c = str.charCodeAt(i) - 48; r *= mul; // 'a' if (c >= 49) { b = c - 49 + 0xa; // 'A' } else if (c >= 17) { b = c - 17 + 0xa; // '0' - '9' } else { b = c; } assert(c >= 0 && b < mul, 'Invalid character'); r += b; } return r; } BN.prototype._parseBase = function _parseBase (number, base, start) { // Initialize as zero this.words = [0]; this.length = 1; // Find length of limb in base for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) { limbLen++; } limbLen--; limbPow = (limbPow / base) | 0; var total = number.length - start; var mod = total % limbLen; var end = Math.min(total, total - mod) + start; var word = 0; for (var i = start; i < end; i += limbLen) { word = parseBase(number, i, i + limbLen, base); this.imuln(limbPow); if (this.words[0] + word < 0x4000000) { this.words[0] += word; } else { this._iaddn(word); } } if (mod !== 0) { var pow = 1; word = parseBase(number, i, number.length, base); for (i = 0; i < mod; i++) { pow *= base; } this.imuln(pow); if (this.words[0] + word < 0x4000000) { this.words[0] += word; } else { this._iaddn(word); } } this._strip(); }; BN.prototype.copy = function copy (dest) { dest.words = new Array(this.length); for (var i = 0; i < this.length; i++) { dest.words[i] = this.words[i]; } dest.length = this.length; dest.negative = this.negative; dest.red = this.red; }; function move (dest, src) { dest.words = src.words; dest.length = src.length; dest.negative = src.negative; dest.red = src.red; } BN.prototype._move = function _move (dest) { move(dest, this); }; BN.prototype.clone = function clone () { var r = new BN(null); this.copy(r); return r; }; BN.prototype._expand = function _expand (size) { while (this.length < size) { this.words[this.length++] = 0; } return this; }; // Remove leading `0` from `this` BN.prototype._strip = function strip () { while (this.length > 1 && this.words[this.length - 1] === 0) { this.length--; } return this._normSign(); }; BN.prototype._normSign = function _normSign () { // -0 = 0 if (this.length === 1 && this.words[0] === 0) { this.negative = 0; } return this; }; // Check Symbol.for because not everywhere where Symbol defined // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol#Browser_compatibility if (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function') { try { BN.prototype[Symbol.for('nodejs.util.inspect.custom')] = inspect; } catch (e) { BN.prototype.inspect = inspect; } } else { BN.prototype.inspect = inspect; } function inspect () { return (this.red ? ''; } /* var zeros = []; var groupSizes = []; var groupBases = []; var s = ''; var i = -1; while (++i < BN.wordSize) { zeros[i] = s; s += '0'; } groupSizes[0] = 0; groupSizes[1] = 0; groupBases[0] = 0; groupBases[1] = 0; var base = 2 - 1; while (++base < 36 + 1) { var groupSize = 0; var groupBase = 1; while (groupBase < (1 << BN.wordSize) / base) { groupBase *= base; groupSize += 1; } groupSizes[base] = groupSize; groupBases[base] = groupBase; } */ var zeros = [ '', '0', '00', '000', '0000', '00000', '000000', '0000000', '00000000', '000000000', '0000000000', '00000000000', '000000000000', '0000000000000', '00000000000000', '000000000000000', '0000000000000000', '00000000000000000', '000000000000000000', '0000000000000000000', '00000000000000000000', '000000000000000000000', '0000000000000000000000', '00000000000000000000000', '000000000000000000000000', '0000000000000000000000000' ]; var groupSizes = [ 0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 ]; var groupBases = [ 0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176 ]; BN.prototype.toString = function toString (base, padding) { base = base || 10; padding = padding | 0 || 1; var out; if (base === 16 || base === 'hex') { out = ''; var off = 0; var carry = 0; for (var i = 0; i < this.length; i++) { var w = this.words[i]; var word = (((w << off) | carry) & 0xffffff).toString(16); carry = (w >>> (24 - off)) & 0xffffff; off += 2; if (off >= 26) { off -= 26; i--; } if (carry !== 0 || i !== this.length - 1) { out = zeros[6 - word.length] + word + out; } else { out = word + out; } } if (carry !== 0) { out = carry.toString(16) + out; } while (out.length % padding !== 0) { out = '0' + out; } if (this.negative !== 0) { out = '-' + out; } return out; } if (base === (base | 0) && base >= 2 && base <= 36) { // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base)); var groupSize = groupSizes[base]; // var groupBase = Math.pow(base, groupSize); var groupBase = groupBases[base]; out = ''; var c = this.clone(); c.negative = 0; while (!c.isZero()) { var r = c.modrn(groupBase).toString(base); c = c.idivn(groupBase); if (!c.isZero()) { out = zeros[groupSize - r.length] + r + out; } else { out = r + out; } } if (this.isZero()) { out = '0' + out; } while (out.length % padding !== 0) { out = '0' + out; } if (this.negative !== 0) { out = '-' + out; } return out; } assert(false, 'Base should be between 2 and 36'); }; BN.prototype.toNumber = function toNumber () { var ret = this.words[0]; if (this.length === 2) { ret += this.words[1] * 0x4000000; } else if (this.length === 3 && this.words[2] === 0x01) { // NOTE: at this stage it is known that the top bit is set ret += 0x10000000000000 + (this.words[1] * 0x4000000); } else if (this.length > 2) { assert(false, 'Number can only safely store up to 53 bits'); } return (this.negative !== 0) ? -ret : ret; }; BN.prototype.toJSON = function toJSON () { return this.toString(16, 2); }; if (Buffer) { BN.prototype.toBuffer = function toBuffer (endian, length) { return this.toArrayLike(Buffer, endian, length); }; } BN.prototype.toArray = function toArray (endian, length) { return this.toArrayLike(Array, endian, length); }; var allocate = function allocate (ArrayType, size) { if (ArrayType.allocUnsafe) { return ArrayType.allocUnsafe(size); } return new ArrayType(size); }; BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) { this._strip(); var byteLength = this.byteLength(); var reqLength = length || Math.max(1, byteLength); assert(byteLength <= reqLength, 'byte array longer than desired length'); assert(reqLength > 0, 'Requested array length <= 0'); var res = allocate(ArrayType, reqLength); var postfix = endian === 'le' ? 'LE' : 'BE'; this['_toArrayLike' + postfix](res, byteLength); return res; }; BN.prototype._toArrayLikeLE = function _toArrayLikeLE (res, byteLength) { var position = 0; var carry = 0; for (var i = 0, shift = 0; i < this.length; i++) { var word = (this.words[i] << shift) | carry; res[position++] = word & 0xff; if (position < res.length) { res[position++] = (word >> 8) & 0xff; } if (position < res.length) { res[position++] = (word >> 16) & 0xff; } if (shift === 6) { if (position < res.length) { res[position++] = (word >> 24) & 0xff; } carry = 0; shift = 0; } else { carry = word >>> 24; shift += 2; } } if (position < res.length) { res[position++] = carry; while (position < res.length) { res[position++] = 0; } } }; BN.prototype._toArrayLikeBE = function _toArrayLikeBE (res, byteLength) { var position = res.length - 1; var carry = 0; for (var i = 0, shift = 0; i < this.length; i++) { var word = (this.words[i] << shift) | carry; res[position--] = word & 0xff; if (position >= 0) { res[position--] = (word >> 8) & 0xff; } if (position >= 0) { res[position--] = (word >> 16) & 0xff; } if (shift === 6) { if (position >= 0) { res[position--] = (word >> 24) & 0xff; } carry = 0; shift = 0; } else { carry = word >>> 24; shift += 2; } } if (position >= 0) { res[position--] = carry; while (position >= 0) { res[position--] = 0; } } }; if (Math.clz32) { BN.prototype._countBits = function _countBits (w) { return 32 - Math.clz32(w); }; } else { BN.prototype._countBits = function _countBits (w) { var t = w; var r = 0; if (t >= 0x1000) { r += 13; t >>>= 13; } if (t >= 0x40) { r += 7; t >>>= 7; } if (t >= 0x8) { r += 4; t >>>= 4; } if (t >= 0x02) { r += 2; t >>>= 2; } return r + t; }; } BN.prototype._zeroBits = function _zeroBits (w) { // Short-cut if (w === 0) return 26; var t = w; var r = 0; if ((t & 0x1fff) === 0) { r += 13; t >>>= 13; } if ((t & 0x7f) === 0) { r += 7; t >>>= 7; } if ((t & 0xf) === 0) { r += 4; t >>>= 4; } if ((t & 0x3) === 0) { r += 2; t >>>= 2; } if ((t & 0x1) === 0) { r++; } return r; }; // Return number of used bits in a BN BN.prototype.bitLength = function bitLength () { var w = this.words[this.length - 1]; var hi = this._countBits(w); return (this.length - 1) * 26 + hi; }; function toBitArray (num) { var w = new Array(num.bitLength()); for (var bit = 0; bit < w.length; bit++) { var off = (bit / 26) | 0; var wbit = bit % 26; w[bit] = (num.words[off] >>> wbit) & 0x01; } return w; } // Number of trailing zero bits BN.prototype.zeroBits = function zeroBits () { if (this.isZero()) return 0; var r = 0; for (var i = 0; i < this.length; i++) { var b = this._zeroBits(this.words[i]); r += b; if (b !== 26) break; } return r; }; BN.prototype.byteLength = function byteLength () { return Math.ceil(this.bitLength() / 8); }; BN.prototype.toTwos = function toTwos (width) { if (this.negative !== 0) { return this.abs().inotn(width).iaddn(1); } return this.clone(); }; BN.prototype.fromTwos = function fromTwos (width) { if (this.testn(width - 1)) { return this.notn(width).iaddn(1).ineg(); } return this.clone(); }; BN.prototype.isNeg = function isNeg () { return this.negative !== 0; }; // Return negative clone of `this` BN.prototype.neg = function neg () { return this.clone().ineg(); }; BN.prototype.ineg = function ineg () { if (!this.isZero()) { this.negative ^= 1; } return this; }; // Or `num` with `this` in-place BN.prototype.iuor = function iuor (num) { while (this.length < num.length) { this.words[this.length++] = 0; } for (var i = 0; i < num.length; i++) { this.words[i] = this.words[i] | num.words[i]; } return this._strip(); }; BN.prototype.ior = function ior (num) { assert((this.negative | num.negative) === 0); return this.iuor(num); }; // Or `num` with `this` BN.prototype.or = function or (num) { if (this.length > num.length) return this.clone().ior(num); return num.clone().ior(this); }; BN.prototype.uor = function uor (num) { if (this.length > num.length) return this.clone().iuor(num); return num.clone().iuor(this); }; // And `num` with `this` in-place BN.prototype.iuand = function iuand (num) { // b = min-length(num, this) var b; if (this.length > num.length) { b = num; } else { b = this; } for (var i = 0; i < b.length; i++) { this.words[i] = this.words[i] & num.words[i]; } this.length = b.length; return this._strip(); }; BN.prototype.iand = function iand (num) { assert((this.negative | num.negative) === 0); return this.iuand(num); }; // And `num` with `this` BN.prototype.and = function and (num) { if (this.length > num.length) return this.clone().iand(num); return num.clone().iand(this); }; BN.prototype.uand = function uand (num) { if (this.length > num.length) return this.clone().iuand(num); return num.clone().iuand(this); }; // Xor `num` with `this` in-place BN.prototype.iuxor = function iuxor (num) { // a.length > b.length var a; var b; if (this.length > num.length) { a = this; b = num; } else { a = num; b = this; } for (var i = 0; i < b.length; i++) { this.words[i] = a.words[i] ^ b.words[i]; } if (this !== a) { for (; i < a.length; i++) { this.words[i] = a.words[i]; } } this.length = a.length; return this._strip(); }; BN.prototype.ixor = function ixor (num) { assert((this.negative | num.negative) === 0); return this.iuxor(num); }; // Xor `num` with `this` BN.prototype.xor = function xor (num) { if (this.length > num.length) return this.clone().ixor(num); return num.clone().ixor(this); }; BN.prototype.uxor = function uxor (num) { if (this.length > num.length) return this.clone().iuxor(num); return num.clone().iuxor(this); }; // Not ``this`` with ``width`` bitwidth BN.prototype.inotn = function inotn (width) { assert(typeof width === 'number' && width >= 0); var bytesNeeded = Math.ceil(width / 26) | 0; var bitsLeft = width % 26; // Extend the buffer with leading zeroes this._expand(bytesNeeded); if (bitsLeft > 0) { bytesNeeded--; } // Handle complete words for (var i = 0; i < bytesNeeded; i++) { this.words[i] = ~this.words[i] & 0x3ffffff; } // Handle the residue if (bitsLeft > 0) { this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft)); } // And remove leading zeroes return this._strip(); }; BN.prototype.notn = function notn (width) { return this.clone().inotn(width); }; // Set `bit` of `this` BN.prototype.setn = function setn (bit, val) { assert(typeof bit === 'number' && bit >= 0); var off = (bit / 26) | 0; var wbit = bit % 26; this._expand(off + 1); if (val) { this.words[off] = this.words[off] | (1 << wbit); } else { this.words[off] = this.words[off] & ~(1 << wbit); } return this._strip(); }; // Add `num` to `this` in-place BN.prototype.iadd = function iadd (num) { var r; // negative + positive if (this.negative !== 0 && num.negative === 0) { this.negative = 0; r = this.isub(num); this.negative ^= 1; return this._normSign(); // positive + negative } else if (this.negative === 0 && num.negative !== 0) { num.negative = 0; r = this.isub(num); num.negative = 1; return r._normSign(); } // a.length > b.length var a, b; if (this.length > num.length) { a = this; b = num; } else { a = num; b = this; } var carry = 0; for (var i = 0; i < b.length; i++) { r = (a.words[i] | 0) + (b.words[i] | 0) + carry; this.words[i] = r & 0x3ffffff; carry = r >>> 26; } for (; carry !== 0 && i < a.length; i++) { r = (a.words[i] | 0) + carry; this.words[i] = r & 0x3ffffff; carry = r >>> 26; } this.length = a.length; if (carry !== 0) { this.words[this.length] = carry; this.length++; // Copy the rest of the words } else if (a !== this) { for (; i < a.length; i++) { this.words[i] = a.words[i]; } } return this; }; // Add `num` to `this` BN.prototype.add = function add (num) { var res; if (num.negative !== 0 && this.negative === 0) { num.negative = 0; res = this.sub(num); num.negative ^= 1; return res; } else if (num.negative === 0 && this.negative !== 0) { this.negative = 0; res = num.sub(this); this.negative = 1; return res; } if (this.length > num.length) return this.clone().iadd(num); return num.clone().iadd(this); }; // Subtract `num` from `this` in-place BN.prototype.isub = function isub (num) { // this - (-num) = this + num if (num.negative !== 0) { num.negative = 0; var r = this.iadd(num); num.negative = 1; return r._normSign(); // -this - num = -(this + num) } else if (this.negative !== 0) { this.negative = 0; this.iadd(num); this.negative = 1; return this._normSign(); } // At this point both numbers are positive var cmp = this.cmp(num); // Optimization - zeroify if (cmp === 0) { this.negative = 0; this.length = 1; this.words[0] = 0; return this; } // a > b var a, b; if (cmp > 0) { a = this; b = num; } else { a = num; b = this; } var carry = 0; for (var i = 0; i < b.length; i++) { r = (a.words[i] | 0) - (b.words[i] | 0) + carry; carry = r >> 26; this.words[i] = r & 0x3ffffff; } for (; carry !== 0 && i < a.length; i++) { r = (a.words[i] | 0) + carry; carry = r >> 26; this.words[i] = r & 0x3ffffff; } // Copy rest of the words if (carry === 0 && i < a.length && a !== this) { for (; i < a.length; i++) { this.words[i] = a.words[i]; } } this.length = Math.max(this.length, i); if (a !== this) { this.negative = 1; } return this._strip(); }; // Subtract `num` from `this` BN.prototype.sub = function sub (num) { return this.clone().isub(num); }; function smallMulTo (self, num, out) { out.negative = num.negative ^ self.negative; var len = (self.length + num.length) | 0; out.length = len; len = (len - 1) | 0; // Peel one iteration (compiler can't do it, because of code complexity) var a = self.words[0] | 0; var b = num.words[0] | 0; var r = a * b; var lo = r & 0x3ffffff; var carry = (r / 0x4000000) | 0; out.words[0] = lo; for (var k = 1; k < len; k++) { // Sum all words with the same `i + j = k` and accumulate `ncarry`, // note that ncarry could be >= 0x3ffffff var ncarry = carry >>> 26; var rword = carry & 0x3ffffff; var maxJ = Math.min(k, num.length - 1); for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { var i = (k - j) | 0; a = self.words[i] | 0; b = num.words[j] | 0; r = a * b + rword; ncarry += (r / 0x4000000) | 0; rword = r & 0x3ffffff; } out.words[k] = rword | 0; carry = ncarry | 0; } if (carry !== 0) { out.words[k] = carry | 0; } else { out.length--; } return out._strip(); } // TODO(indutny): it may be reasonable to omit it for users who don't need // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit // multiplication (like elliptic secp256k1). var comb10MulTo = function comb10MulTo (self, num, out) { var a = self.words; var b = num.words; var o = out.words; var c = 0; var lo; var mid; var hi; var a0 = a[0] | 0; var al0 = a0 & 0x1fff; var ah0 = a0 >>> 13; var a1 = a[1] | 0; var al1 = a1 & 0x1fff; var ah1 = a1 >>> 13; var a2 = a[2] | 0; var al2 = a2 & 0x1fff; var ah2 = a2 >>> 13; var a3 = a[3] | 0; var al3 = a3 & 0x1fff; var ah3 = a3 >>> 13; var a4 = a[4] | 0; var al4 = a4 & 0x1fff; var ah4 = a4 >>> 13; var a5 = a[5] | 0; var al5 = a5 & 0x1fff; var ah5 = a5 >>> 13; var a6 = a[6] | 0; var al6 = a6 & 0x1fff; var ah6 = a6 >>> 13; var a7 = a[7] | 0; var al7 = a7 & 0x1fff; var ah7 = a7 >>> 13; var a8 = a[8] | 0; var al8 = a8 & 0x1fff; var ah8 = a8 >>> 13; var a9 = a[9] | 0; var al9 = a9 & 0x1fff; var ah9 = a9 >>> 13; var b0 = b[0] | 0; var bl0 = b0 & 0x1fff; var bh0 = b0 >>> 13; var b1 = b[1] | 0; var bl1 = b1 & 0x1fff; var bh1 = b1 >>> 13; var b2 = b[2] | 0; var bl2 = b2 & 0x1fff; var bh2 = b2 >>> 13; var b3 = b[3] | 0; var bl3 = b3 & 0x1fff; var bh3 = b3 >>> 13; var b4 = b[4] | 0; var bl4 = b4 & 0x1fff; var bh4 = b4 >>> 13; var b5 = b[5] | 0; var bl5 = b5 & 0x1fff; var bh5 = b5 >>> 13; var b6 = b[6] | 0; var bl6 = b6 & 0x1fff; var bh6 = b6 >>> 13; var b7 = b[7] | 0; var bl7 = b7 & 0x1fff; var bh7 = b7 >>> 13; var b8 = b[8] | 0; var bl8 = b8 & 0x1fff; var bh8 = b8 >>> 13; var b9 = b[9] | 0; var bl9 = b9 & 0x1fff; var bh9 = b9 >>> 13; out.negative = self.negative ^ num.negative; out.length = 19; /* k = 0 */ lo = Math.imul(al0, bl0); mid = Math.imul(al0, bh0); mid = (mid + Math.imul(ah0, bl0)) | 0; hi = Math.imul(ah0, bh0); var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0; w0 &= 0x3ffffff; /* k = 1 */ lo = Math.imul(al1, bl0); mid = Math.imul(al1, bh0); mid = (mid + Math.imul(ah1, bl0)) | 0; hi = Math.imul(ah1, bh0); lo = (lo + Math.imul(al0, bl1)) | 0; mid = (mid + Math.imul(al0, bh1)) | 0; mid = (mid + Math.imul(ah0, bl1)) | 0; hi = (hi + Math.imul(ah0, bh1)) | 0; var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0; w1 &= 0x3ffffff; /* k = 2 */ lo = Math.imul(al2, bl0); mid = Math.imul(al2, bh0); mid = (mid + Math.imul(ah2, bl0)) | 0; hi = Math.imul(ah2, bh0); lo = (lo + Math.imul(al1, bl1)) | 0; mid = (mid + Math.imul(al1, bh1)) | 0; mid = (mid + Math.imul(ah1, bl1)) | 0; hi = (hi + Math.imul(ah1, bh1)) | 0; lo = (lo + Math.imul(al0, bl2)) | 0; mid = (mid + Math.imul(al0, bh2)) | 0; mid = (mid + Math.imul(ah0, bl2)) | 0; hi = (hi + Math.imul(ah0, bh2)) | 0; var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0; w2 &= 0x3ffffff; /* k = 3 */ lo = Math.imul(al3, bl0); mid = Math.imul(al3, bh0); mid = (mid + Math.imul(ah3, bl0)) | 0; hi = Math.imul(ah3, bh0); lo = (lo + Math.imul(al2, bl1)) | 0; mid = (mid + Math.imul(al2, bh1)) | 0; mid = (mid + Math.imul(ah2, bl1)) | 0; hi = (hi + Math.imul(ah2, bh1)) | 0; lo = (lo + Math.imul(al1, bl2)) | 0; mid = (mid + Math.imul(al1, bh2)) | 0; mid = (mid + Math.imul(ah1, bl2)) | 0; hi = (hi + Math.imul(ah1, bh2)) | 0; lo = (lo + Math.imul(al0, bl3)) | 0; mid = (mid + Math.imul(al0, bh3)) | 0; mid = (mid + Math.imul(ah0, bl3)) | 0; hi = (hi + Math.imul(ah0, bh3)) | 0; var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0; w3 &= 0x3ffffff; /* k = 4 */ lo = Math.imul(al4, bl0); mid = Math.imul(al4, bh0); mid = (mid + Math.imul(ah4, bl0)) | 0; hi = Math.imul(ah4, bh0); lo = (lo + Math.imul(al3, bl1)) | 0; mid = (mid + Math.imul(al3, bh1)) | 0; mid = (mid + Math.imul(ah3, bl1)) | 0; hi = (hi + Math.imul(ah3, bh1)) | 0; lo = (lo + Math.imul(al2, bl2)) | 0; mid = (mid + Math.imul(al2, bh2)) | 0; mid = (mid + Math.imul(ah2, bl2)) | 0; hi = (hi + Math.imul(ah2, bh2)) | 0; lo = (lo + Math.imul(al1, bl3)) | 0; mid = (mid + Math.imul(al1, bh3)) | 0; mid = (mid + Math.imul(ah1, bl3)) | 0; hi = (hi + Math.imul(ah1, bh3)) | 0; lo = (lo + Math.imul(al0, bl4)) | 0; mid = (mid + Math.imul(al0, bh4)) | 0; mid = (mid + Math.imul(ah0, bl4)) | 0; hi = (hi + Math.imul(ah0, bh4)) | 0; var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0; w4 &= 0x3ffffff; /* k = 5 */ lo = Math.imul(al5, bl0); mid = Math.imul(al5, bh0); mid = (mid + Math.imul(ah5, bl0)) | 0; hi = Math.imul(ah5, bh0); lo = (lo + Math.imul(al4, bl1)) | 0; mid = (mid + Math.imul(al4, bh1)) | 0; mid = (mid + Math.imul(ah4, bl1)) | 0; hi = (hi + Math.imul(ah4, bh1)) | 0; lo = (lo + Math.imul(al3, bl2)) | 0; mid = (mid + Math.imul(al3, bh2)) | 0; mid = (mid + Math.imul(ah3, bl2)) | 0; hi = (hi + Math.imul(ah3, bh2)) | 0; lo = (lo + Math.imul(al2, bl3)) | 0; mid = (mid + Math.imul(al2, bh3)) | 0; mid = (mid + Math.imul(ah2, bl3)) | 0; hi = (hi + Math.imul(ah2, bh3)) | 0; lo = (lo + Math.imul(al1, bl4)) | 0; mid = (mid + Math.imul(al1, bh4)) | 0; mid = (mid + Math.imul(ah1, bl4)) | 0; hi = (hi + Math.imul(ah1, bh4)) | 0; lo = (lo + Math.imul(al0, bl5)) | 0; mid = (mid + Math.imul(al0, bh5)) | 0; mid = (mid + Math.imul(ah0, bl5)) | 0; hi = (hi + Math.imul(ah0, bh5)) | 0; var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0; w5 &= 0x3ffffff; /* k = 6 */ lo = Math.imul(al6, bl0); mid = Math.imul(al6, bh0); mid = (mid + Math.imul(ah6, bl0)) | 0; hi = Math.imul(ah6, bh0); lo = (lo + Math.imul(al5, bl1)) | 0; mid = (mid + Math.imul(al5, bh1)) | 0; mid = (mid + Math.imul(ah5, bl1)) | 0; hi = (hi + Math.imul(ah5, bh1)) | 0; lo = (lo + Math.imul(al4, bl2)) | 0; mid = (mid + Math.imul(al4, bh2)) | 0; mid = (mid + Math.imul(ah4, bl2)) | 0; hi = (hi + Math.imul(ah4, bh2)) | 0; lo = (lo + Math.imul(al3, bl3)) | 0; mid = (mid + Math.imul(al3, bh3)) | 0; mid = (mid + Math.imul(ah3, bl3)) | 0; hi = (hi + Math.imul(ah3, bh3)) | 0; lo = (lo + Math.imul(al2, bl4)) | 0; mid = (mid + Math.imul(al2, bh4)) | 0; mid = (mid + Math.imul(ah2, bl4)) | 0; hi = (hi + Math.imul(ah2, bh4)) | 0; lo = (lo + Math.imul(al1, bl5)) | 0; mid = (mid + Math.imul(al1, bh5)) | 0; mid = (mid + Math.imul(ah1, bl5)) | 0; hi = (hi + Math.imul(ah1, bh5)) | 0; lo = (lo + Math.imul(al0, bl6)) | 0; mid = (mid + Math.imul(al0, bh6)) | 0; mid = (mid + Math.imul(ah0, bl6)) | 0; hi = (hi + Math.imul(ah0, bh6)) | 0; var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0; w6 &= 0x3ffffff; /* k = 7 */ lo = Math.imul(al7, bl0); mid = Math.imul(al7, bh0); mid = (mid + Math.imul(ah7, bl0)) | 0; hi = Math.imul(ah7, bh0); lo = (lo + Math.imul(al6, bl1)) | 0; mid = (mid + Math.imul(al6, bh1)) | 0; mid = (mid + Math.imul(ah6, bl1)) | 0; hi = (hi + Math.imul(ah6, bh1)) | 0; lo = (lo + Math.imul(al5, bl2)) | 0; mid = (mid + Math.imul(al5, bh2)) | 0; mid = (mid + Math.imul(ah5, bl2)) | 0; hi = (hi + Math.imul(ah5, bh2)) | 0; lo = (lo + Math.imul(al4, bl3)) | 0; mid = (mid + Math.imul(al4, bh3)) | 0; mid = (mid + Math.imul(ah4, bl3)) | 0; hi = (hi + Math.imul(ah4, bh3)) | 0; lo = (lo + Math.imul(al3, bl4)) | 0; mid = (mid + Math.imul(al3, bh4)) | 0; mid = (mid + Math.imul(ah3, bl4)) | 0; hi = (hi + Math.imul(ah3, bh4)) | 0; lo = (lo + Math.imul(al2, bl5)) | 0; mid = (mid + Math.imul(al2, bh5)) | 0; mid = (mid + Math.imul(ah2, bl5)) | 0; hi = (hi + Math.imul(ah2, bh5)) | 0; lo = (lo + Math.imul(al1, bl6)) | 0; mid = (mid + Math.imul(al1, bh6)) | 0; mid = (mid + Math.imul(ah1, bl6)) | 0; hi = (hi + Math.imul(ah1, bh6)) | 0; lo = (lo + Math.imul(al0, bl7)) | 0; mid = (mid + Math.imul(al0, bh7)) | 0; mid = (mid + Math.imul(ah0, bl7)) | 0; hi = (hi + Math.imul(ah0, bh7)) | 0; var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0; w7 &= 0x3ffffff; /* k = 8 */ lo = Math.imul(al8, bl0); mid = Math.imul(al8, bh0); mid = (mid + Math.imul(ah8, bl0)) | 0; hi = Math.imul(ah8, bh0); lo = (lo + Math.imul(al7, bl1)) | 0; mid = (mid + Math.imul(al7, bh1)) | 0; mid = (mid + Math.imul(ah7, bl1)) | 0; hi = (hi + Math.imul(ah7, bh1)) | 0; lo = (lo + Math.imul(al6, bl2)) | 0; mid = (mid + Math.imul(al6, bh2)) | 0; mid = (mid + Math.imul(ah6, bl2)) | 0; hi = (hi + Math.imul(ah6, bh2)) | 0; lo = (lo + Math.imul(al5, bl3)) | 0; mid = (mid + Math.imul(al5, bh3)) | 0; mid = (mid + Math.imul(ah5, bl3)) | 0; hi = (hi + Math.imul(ah5, bh3)) | 0; lo = (lo + Math.imul(al4, bl4)) | 0; mid = (mid + Math.imul(al4, bh4)) | 0; mid = (mid + Math.imul(ah4, bl4)) | 0; hi = (hi + Math.imul(ah4, bh4)) | 0; lo = (lo + Math.imul(al3, bl5)) | 0; mid = (mid + Math.imul(al3, bh5)) | 0; mid = (mid + Math.imul(ah3, bl5)) | 0; hi = (hi + Math.imul(ah3, bh5)) | 0; lo = (lo + Math.imul(al2, bl6)) | 0; mid = (mid + Math.imul(al2, bh6)) | 0; mid = (mid + Math.imul(ah2, bl6)) | 0; hi = (hi + Math.imul(ah2, bh6)) | 0; lo = (lo + Math.imul(al1, bl7)) | 0; mid = (mid + Math.imul(al1, bh7)) | 0; mid = (mid + Math.imul(ah1, bl7)) | 0; hi = (hi + Math.imul(ah1, bh7)) | 0; lo = (lo + Math.imul(al0, bl8)) | 0; mid = (mid + Math.imul(al0, bh8)) | 0; mid = (mid + Math.imul(ah0, bl8)) | 0; hi = (hi + Math.imul(ah0, bh8)) | 0; var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0; w8 &= 0x3ffffff; /* k = 9 */ lo = Math.imul(al9, bl0); mid = Math.imul(al9, bh0); mid = (mid + Math.imul(ah9, bl0)) | 0; hi = Math.imul(ah9, bh0); lo = (lo + Math.imul(al8, bl1)) | 0; mid = (mid + Math.imul(al8, bh1)) | 0; mid = (mid + Math.imul(ah8, bl1)) | 0; hi = (hi + Math.imul(ah8, bh1)) | 0; lo = (lo + Math.imul(al7, bl2)) | 0; mid = (mid + Math.imul(al7, bh2)) | 0; mid = (mid + Math.imul(ah7, bl2)) | 0; hi = (hi + Math.imul(ah7, bh2)) | 0; lo = (lo + Math.imul(al6, bl3)) | 0; mid = (mid + Math.imul(al6, bh3)) | 0; mid = (mid + Math.imul(ah6, bl3)) | 0; hi = (hi + Math.imul(ah6, bh3)) | 0; lo = (lo + Math.imul(al5, bl4)) | 0; mid = (mid + Math.imul(al5, bh4)) | 0; mid = (mid + Math.imul(ah5, bl4)) | 0; hi = (hi + Math.imul(ah5, bh4)) | 0; lo = (lo + Math.imul(al4, bl5)) | 0; mid = (mid + Math.imul(al4, bh5)) | 0; mid = (mid + Math.imul(ah4, bl5)) | 0; hi = (hi + Math.imul(ah4, bh5)) | 0; lo = (lo + Math.imul(al3, bl6)) | 0; mid = (mid + Math.imul(al3, bh6)) | 0; mid = (mid + Math.imul(ah3, bl6)) | 0; hi = (hi + Math.imul(ah3, bh6)) | 0; lo = (lo + Math.imul(al2, bl7)) | 0; mid = (mid + Math.imul(al2, bh7)) | 0; mid = (mid + Math.imul(ah2, bl7)) | 0; hi = (hi + Math.imul(ah2, bh7)) | 0; lo = (lo + Math.imul(al1, bl8)) | 0; mid = (mid + Math.imul(al1, bh8)) | 0; mid = (mid + Math.imul(ah1, bl8)) | 0; hi = (hi + Math.imul(ah1, bh8)) | 0; lo = (lo + Math.imul(al0, bl9)) | 0; mid = (mid + Math.imul(al0, bh9)) | 0; mid = (mid + Math.imul(ah0, bl9)) | 0; hi = (hi + Math.imul(ah0, bh9)) | 0; var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0; w9 &= 0x3ffffff; /* k = 10 */ lo = Math.imul(al9, bl1); mid = Math.imul(al9, bh1); mid = (mid + Math.imul(ah9, bl1)) | 0; hi = Math.imul(ah9, bh1); lo = (lo + Math.imul(al8, bl2)) | 0; mid = (mid + Math.imul(al8, bh2)) | 0; mid = (mid + Math.imul(ah8, bl2)) | 0; hi = (hi + Math.imul(ah8, bh2)) | 0; lo = (lo + Math.imul(al7, bl3)) | 0; mid = (mid + Math.imul(al7, bh3)) | 0; mid = (mid + Math.imul(ah7, bl3)) | 0; hi = (hi + Math.imul(ah7, bh3)) | 0; lo = (lo + Math.imul(al6, bl4)) | 0; mid = (mid + Math.imul(al6, bh4)) | 0; mid = (mid + Math.imul(ah6, bl4)) | 0; hi = (hi + Math.imul(ah6, bh4)) | 0; lo = (lo + Math.imul(al5, bl5)) | 0; mid = (mid + Math.imul(al5, bh5)) | 0; mid = (mid + Math.imul(ah5, bl5)) | 0; hi = (hi + Math.imul(ah5, bh5)) | 0; lo = (lo + Math.imul(al4, bl6)) | 0; mid = (mid + Math.imul(al4, bh6)) | 0; mid = (mid + Math.imul(ah4, bl6)) | 0; hi = (hi + Math.imul(ah4, bh6)) | 0; lo = (lo + Math.imul(al3, bl7)) | 0; mid = (mid + Math.imul(al3, bh7)) | 0; mid = (mid + Math.imul(ah3, bl7)) | 0; hi = (hi + Math.imul(ah3, bh7)) | 0; lo = (lo + Math.imul(al2, bl8)) | 0; mid = (mid + Math.imul(al2, bh8)) | 0; mid = (mid + Math.imul(ah2, bl8)) | 0; hi = (hi + Math.imul(ah2, bh8)) | 0; lo = (lo + Math.imul(al1, bl9)) | 0; mid = (mid + Math.imul(al1, bh9)) | 0; mid = (mid + Math.imul(ah1, bl9)) | 0; hi = (hi + Math.imul(ah1, bh9)) | 0; var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0; w10 &= 0x3ffffff; /* k = 11 */ lo = Math.imul(al9, bl2); mid = Math.imul(al9, bh2); mid = (mid + Math.imul(ah9, bl2)) | 0; hi = Math.imul(ah9, bh2); lo = (lo + Math.imul(al8, bl3)) | 0; mid = (mid + Math.imul(al8, bh3)) | 0; mid = (mid + Math.imul(ah8, bl3)) | 0; hi = (hi + Math.imul(ah8, bh3)) | 0; lo = (lo + Math.imul(al7, bl4)) | 0; mid = (mid + Math.imul(al7, bh4)) | 0; mid = (mid + Math.imul(ah7, bl4)) | 0; hi = (hi + Math.imul(ah7, bh4)) | 0; lo = (lo + Math.imul(al6, bl5)) | 0; mid = (mid + Math.imul(al6, bh5)) | 0; mid = (mid + Math.imul(ah6, bl5)) | 0; hi = (hi + Math.imul(ah6, bh5)) | 0; lo = (lo + Math.imul(al5, bl6)) | 0; mid = (mid + Math.imul(al5, bh6)) | 0; mid = (mid + Math.imul(ah5, bl6)) | 0; hi = (hi + Math.imul(ah5, bh6)) | 0; lo = (lo + Math.imul(al4, bl7)) | 0; mid = (mid + Math.imul(al4, bh7)) | 0; mid = (mid + Math.imul(ah4, bl7)) | 0; hi = (hi + Math.imul(ah4, bh7)) | 0; lo = (lo + Math.imul(al3, bl8)) | 0; mid = (mid + Math.imul(al3, bh8)) | 0; mid = (mid + Math.imul(ah3, bl8)) | 0; hi = (hi + Math.imul(ah3, bh8)) | 0; lo = (lo + Math.imul(al2, bl9)) | 0; mid = (mid + Math.imul(al2, bh9)) | 0; mid = (mid + Math.imul(ah2, bl9)) | 0; hi = (hi + Math.imul(ah2, bh9)) | 0; var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0; w11 &= 0x3ffffff; /* k = 12 */ lo = Math.imul(al9, bl3); mid = Math.imul(al9, bh3); mid = (mid + Math.imul(ah9, bl3)) | 0; hi = Math.imul(ah9, bh3); lo = (lo + Math.imul(al8, bl4)) | 0; mid = (mid + Math.imul(al8, bh4)) | 0; mid = (mid + Math.imul(ah8, bl4)) | 0; hi = (hi + Math.imul(ah8, bh4)) | 0; lo = (lo + Math.imul(al7, bl5)) | 0; mid = (mid + Math.imul(al7, bh5)) | 0; mid = (mid + Math.imul(ah7, bl5)) | 0; hi = (hi + Math.imul(ah7, bh5)) | 0; lo = (lo + Math.imul(al6, bl6)) | 0; mid = (mid + Math.imul(al6, bh6)) | 0; mid = (mid + Math.imul(ah6, bl6)) | 0; hi = (hi + Math.imul(ah6, bh6)) | 0; lo = (lo + Math.imul(al5, bl7)) | 0; mid = (mid + Math.imul(al5, bh7)) | 0; mid = (mid + Math.imul(ah5, bl7)) | 0; hi = (hi + Math.imul(ah5, bh7)) | 0; lo = (lo + Math.imul(al4, bl8)) | 0; mid = (mid + Math.imul(al4, bh8)) | 0; mid = (mid + Math.imul(ah4, bl8)) | 0; hi = (hi + Math.imul(ah4, bh8)) | 0; lo = (lo + Math.imul(al3, bl9)) | 0; mid = (mid + Math.imul(al3, bh9)) | 0; mid = (mid + Math.imul(ah3, bl9)) | 0; hi = (hi + Math.imul(ah3, bh9)) | 0; var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0; w12 &= 0x3ffffff; /* k = 13 */ lo = Math.imul(al9, bl4); mid = Math.imul(al9, bh4); mid = (mid + Math.imul(ah9, bl4)) | 0; hi = Math.imul(ah9, bh4); lo = (lo + Math.imul(al8, bl5)) | 0; mid = (mid + Math.imul(al8, bh5)) | 0; mid = (mid + Math.imul(ah8, bl5)) | 0; hi = (hi + Math.imul(ah8, bh5)) | 0; lo = (lo + Math.imul(al7, bl6)) | 0; mid = (mid + Math.imul(al7, bh6)) | 0; mid = (mid + Math.imul(ah7, bl6)) | 0; hi = (hi + Math.imul(ah7, bh6)) | 0; lo = (lo + Math.imul(al6, bl7)) | 0; mid = (mid + Math.imul(al6, bh7)) | 0; mid = (mid + Math.imul(ah6, bl7)) | 0; hi = (hi + Math.imul(ah6, bh7)) | 0; lo = (lo + Math.imul(al5, bl8)) | 0; mid = (mid + Math.imul(al5, bh8)) | 0; mid = (mid + Math.imul(ah5, bl8)) | 0; hi = (hi + Math.imul(ah5, bh8)) | 0; lo = (lo + Math.imul(al4, bl9)) | 0; mid = (mid + Math.imul(al4, bh9)) | 0; mid = (mid + Math.imul(ah4, bl9)) | 0; hi = (hi + Math.imul(ah4, bh9)) | 0; var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0; w13 &= 0x3ffffff; /* k = 14 */ lo = Math.imul(al9, bl5); mid = Math.imul(al9, bh5); mid = (mid + Math.imul(ah9, bl5)) | 0; hi = Math.imul(ah9, bh5); lo = (lo + Math.imul(al8, bl6)) | 0; mid = (mid + Math.imul(al8, bh6)) | 0; mid = (mid + Math.imul(ah8, bl6)) | 0; hi = (hi + Math.imul(ah8, bh6)) | 0; lo = (lo + Math.imul(al7, bl7)) | 0; mid = (mid + Math.imul(al7, bh7)) | 0; mid = (mid + Math.imul(ah7, bl7)) | 0; hi = (hi + Math.imul(ah7, bh7)) | 0; lo = (lo + Math.imul(al6, bl8)) | 0; mid = (mid + Math.imul(al6, bh8)) | 0; mid = (mid + Math.imul(ah6, bl8)) | 0; hi = (hi + Math.imul(ah6, bh8)) | 0; lo = (lo + Math.imul(al5, bl9)) | 0; mid = (mid + Math.imul(al5, bh9)) | 0; mid = (mid + Math.imul(ah5, bl9)) | 0; hi = (hi + Math.imul(ah5, bh9)) | 0; var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0; w14 &= 0x3ffffff; /* k = 15 */ lo = Math.imul(al9, bl6); mid = Math.imul(al9, bh6); mid = (mid + Math.imul(ah9, bl6)) | 0; hi = Math.imul(ah9, bh6); lo = (lo + Math.imul(al8, bl7)) | 0; mid = (mid + Math.imul(al8, bh7)) | 0; mid = (mid + Math.imul(ah8, bl7)) | 0; hi = (hi + Math.imul(ah8, bh7)) | 0; lo = (lo + Math.imul(al7, bl8)) | 0; mid = (mid + Math.imul(al7, bh8)) | 0; mid = (mid + Math.imul(ah7, bl8)) | 0; hi = (hi + Math.imul(ah7, bh8)) | 0; lo = (lo + Math.imul(al6, bl9)) | 0; mid = (mid + Math.imul(al6, bh9)) | 0; mid = (mid + Math.imul(ah6, bl9)) | 0; hi = (hi + Math.imul(ah6, bh9)) | 0; var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0; w15 &= 0x3ffffff; /* k = 16 */ lo = Math.imul(al9, bl7); mid = Math.imul(al9, bh7); mid = (mid + Math.imul(ah9, bl7)) | 0; hi = Math.imul(ah9, bh7); lo = (lo + Math.imul(al8, bl8)) | 0; mid = (mid + Math.imul(al8, bh8)) | 0; mid = (mid + Math.imul(ah8, bl8)) | 0; hi = (hi + Math.imul(ah8, bh8)) | 0; lo = (lo + Math.imul(al7, bl9)) | 0; mid = (mid + Math.imul(al7, bh9)) | 0; mid = (mid + Math.imul(ah7, bl9)) | 0; hi = (hi + Math.imul(ah7, bh9)) | 0; var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0; w16 &= 0x3ffffff; /* k = 17 */ lo = Math.imul(al9, bl8); mid = Math.imul(al9, bh8); mid = (mid + Math.imul(ah9, bl8)) | 0; hi = Math.imul(ah9, bh8); lo = (lo + Math.imul(al8, bl9)) | 0; mid = (mid + Math.imul(al8, bh9)) | 0; mid = (mid + Math.imul(ah8, bl9)) | 0; hi = (hi + Math.imul(ah8, bh9)) | 0; var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0; w17 &= 0x3ffffff; /* k = 18 */ lo = Math.imul(al9, bl9); mid = Math.imul(al9, bh9); mid = (mid + Math.imul(ah9, bl9)) | 0; hi = Math.imul(ah9, bh9); var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0; w18 &= 0x3ffffff; o[0] = w0; o[1] = w1; o[2] = w2; o[3] = w3; o[4] = w4; o[5] = w5; o[6] = w6; o[7] = w7; o[8] = w8; o[9] = w9; o[10] = w10; o[11] = w11; o[12] = w12; o[13] = w13; o[14] = w14; o[15] = w15; o[16] = w16; o[17] = w17; o[18] = w18; if (c !== 0) { o[19] = c; out.length++; } return out; }; // Polyfill comb if (!Math.imul) { comb10MulTo = smallMulTo; } function bigMulTo (self, num, out) { out.negative = num.negative ^ self.negative; out.length = self.length + num.length; var carry = 0; var hncarry = 0; for (var k = 0; k < out.length - 1; k++) { // Sum all words with the same `i + j = k` and accumulate `ncarry`, // note that ncarry could be >= 0x3ffffff var ncarry = hncarry; hncarry = 0; var rword = carry & 0x3ffffff; var maxJ = Math.min(k, num.length - 1); for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { var i = k - j; var a = self.words[i] | 0; var b = num.words[j] | 0; var r = a * b; var lo = r & 0x3ffffff; ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0; lo = (lo + rword) | 0; rword = lo & 0x3ffffff; ncarry = (ncarry + (lo >>> 26)) | 0; hncarry += ncarry >>> 26; ncarry &= 0x3ffffff; } out.words[k] = rword; carry = ncarry; ncarry = hncarry; } if (carry !== 0) { out.words[k] = carry; } else { out.length--; } return out._strip(); } function jumboMulTo (self, num, out) { // Temporary disable, see https://github.com/indutny/bn.js/issues/211 // var fftm = new FFTM(); // return fftm.mulp(self, num, out); return bigMulTo(self, num, out); } BN.prototype.mulTo = function mulTo (num, out) { var res; var len = this.length + num.length; if (this.length === 10 && num.length === 10) { res = comb10MulTo(this, num, out); } else if (len < 63) { res = smallMulTo(this, num, out); } else if (len < 1024) { res = bigMulTo(this, num, out); } else { res = jumboMulTo(this, num, out); } return res; }; // Cooley-Tukey algorithm for FFT // slightly revisited to rely on looping instead of recursion function FFTM (x, y) { this.x = x; this.y = y; } FFTM.prototype.makeRBT = function makeRBT (N) { var t = new Array(N); var l = BN.prototype._countBits(N) - 1; for (var i = 0; i < N; i++) { t[i] = this.revBin(i, l, N); } return t; }; // Returns binary-reversed representation of `x` FFTM.prototype.revBin = function revBin (x, l, N) { if (x === 0 || x === N - 1) return x; var rb = 0; for (var i = 0; i < l; i++) { rb |= (x & 1) << (l - i - 1); x >>= 1; } return rb; }; // Performs "tweedling" phase, therefore 'emulating' // behaviour of the recursive algorithm FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) { for (var i = 0; i < N; i++) { rtws[i] = rws[rbt[i]]; itws[i] = iws[rbt[i]]; } }; FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) { this.permute(rbt, rws, iws, rtws, itws, N); for (var s = 1; s < N; s <<= 1) { var l = s << 1; var rtwdf = Math.cos(2 * Math.PI / l); var itwdf = Math.sin(2 * Math.PI / l); for (var p = 0; p < N; p += l) { var rtwdf_ = rtwdf; var itwdf_ = itwdf; for (var j = 0; j < s; j++) { var re = rtws[p + j]; var ie = itws[p + j]; var ro = rtws[p + j + s]; var io = itws[p + j + s]; var rx = rtwdf_ * ro - itwdf_ * io; io = rtwdf_ * io + itwdf_ * ro; ro = rx; rtws[p + j] = re + ro; itws[p + j] = ie + io; rtws[p + j + s] = re - ro; itws[p + j + s] = ie - io; /* jshint maxdepth : false */ if (j !== l) { rx = rtwdf * rtwdf_ - itwdf * itwdf_; itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_; rtwdf_ = rx; } } } } }; FFTM.prototype.guessLen13b = function guessLen13b (n, m) { var N = Math.max(m, n) | 1; var odd = N & 1; var i = 0; for (N = N / 2 | 0; N; N = N >>> 1) { i++; } return 1 << i + 1 + odd; }; FFTM.prototype.conjugate = function conjugate (rws, iws, N) { if (N <= 1) return; for (var i = 0; i < N / 2; i++) { var t = rws[i]; rws[i] = rws[N - i - 1]; rws[N - i - 1] = t; t = iws[i]; iws[i] = -iws[N - i - 1]; iws[N - i - 1] = -t; } }; FFTM.prototype.normalize13b = function normalize13b (ws, N) { var carry = 0; for (var i = 0; i < N / 2; i++) { var w = Math.round(ws[2 * i + 1] / N) * 0x2000 + Math.round(ws[2 * i] / N) + carry; ws[i] = w & 0x3ffffff; if (w < 0x4000000) { carry = 0; } else { carry = w / 0x4000000 | 0; } } return ws; }; FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) { var carry = 0; for (var i = 0; i < len; i++) { carry = carry + (ws[i] | 0); rws[2 * i] = carry & 0x1fff; carry = carry >>> 13; rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13; } // Pad with zeroes for (i = 2 * len; i < N; ++i) { rws[i] = 0; } assert(carry === 0); assert((carry & ~0x1fff) === 0); }; FFTM.prototype.stub = function stub (N) { var ph = new Array(N); for (var i = 0; i < N; i++) { ph[i] = 0; } return ph; }; FFTM.prototype.mulp = function mulp (x, y, out) { var N = 2 * this.guessLen13b(x.length, y.length); var rbt = this.makeRBT(N); var _ = this.stub(N); var rws = new Array(N); var rwst = new Array(N); var iwst = new Array(N); var nrws = new Array(N); var nrwst = new Array(N); var niwst = new Array(N); var rmws = out.words; rmws.length = N; this.convert13b(x.words, x.length, rws, N); this.convert13b(y.words, y.length, nrws, N); this.transform(rws, _, rwst, iwst, N, rbt); this.transform(nrws, _, nrwst, niwst, N, rbt); for (var i = 0; i < N; i++) { var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i]; iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i]; rwst[i] = rx; } this.conjugate(rwst, iwst, N); this.transform(rwst, iwst, rmws, _, N, rbt); this.conjugate(rmws, _, N); this.normalize13b(rmws, N); out.negative = x.negative ^ y.negative; out.length = x.length + y.length; return out._strip(); }; // Multiply `this` by `num` BN.prototype.mul = function mul (num) { var out = new BN(null); out.words = new Array(this.length + num.length); return this.mulTo(num, out); }; // Multiply employing FFT BN.prototype.mulf = function mulf (num) { var out = new BN(null); out.words = new Array(this.length + num.length); return jumboMulTo(this, num, out); }; // In-place Multiplication BN.prototype.imul = function imul (num) { return this.clone().mulTo(num, this); }; BN.prototype.imuln = function imuln (num) { var isNegNum = num < 0; if (isNegNum) num = -num; assert(typeof num === 'number'); assert(num < 0x4000000); // Carry var carry = 0; for (var i = 0; i < this.length; i++) { var w = (this.words[i] | 0) * num; var lo = (w & 0x3ffffff) + (carry & 0x3ffffff); carry >>= 26; carry += (w / 0x4000000) | 0; // NOTE: lo is 27bit maximum carry += lo >>> 26; this.words[i] = lo & 0x3ffffff; } if (carry !== 0) { this.words[i] = carry; this.length++; } return isNegNum ? this.ineg() : this; }; BN.prototype.muln = function muln (num) { return this.clone().imuln(num); }; // `this` * `this` BN.prototype.sqr = function sqr () { return this.mul(this); }; // `this` * `this` in-place BN.prototype.isqr = function isqr () { return this.imul(this.clone()); }; // Math.pow(`this`, `num`) BN.prototype.pow = function pow (num) { var w = toBitArray(num); if (w.length === 0) return new BN(1); // Skip leading zeroes var res = this; for (var i = 0; i < w.length; i++, res = res.sqr()) { if (w[i] !== 0) break; } if (++i < w.length) { for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) { if (w[i] === 0) continue; res = res.mul(q); } } return res; }; // Shift-left in-place BN.prototype.iushln = function iushln (bits) { assert(typeof bits === 'number' && bits >= 0); var r = bits % 26; var s = (bits - r) / 26; var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r); var i; if (r !== 0) { var carry = 0; for (i = 0; i < this.length; i++) { var newCarry = this.words[i] & carryMask; var c = ((this.words[i] | 0) - newCarry) << r; this.words[i] = c | carry; carry = newCarry >>> (26 - r); } if (carry) { this.words[i] = carry; this.length++; } } if (s !== 0) { for (i = this.length - 1; i >= 0; i--) { this.words[i + s] = this.words[i]; } for (i = 0; i < s; i++) { this.words[i] = 0; } this.length += s; } return this._strip(); }; BN.prototype.ishln = function ishln (bits) { // TODO(indutny): implement me assert(this.negative === 0); return this.iushln(bits); }; // Shift-right in-place // NOTE: `hint` is a lowest bit before trailing zeroes // NOTE: if `extended` is present - it will be filled with destroyed bits BN.prototype.iushrn = function iushrn (bits, hint, extended) { assert(typeof bits === 'number' && bits >= 0); var h; if (hint) { h = (hint - (hint % 26)) / 26; } else { h = 0; } var r = bits % 26; var s = Math.min((bits - r) / 26, this.length); var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); var maskedWords = extended; h -= s; h = Math.max(0, h); // Extended mode, copy masked part if (maskedWords) { for (var i = 0; i < s; i++) { maskedWords.words[i] = this.words[i]; } maskedWords.length = s; } if (s === 0) { // No-op, we should not move anything at all } else if (this.length > s) { this.length -= s; for (i = 0; i < this.length; i++) { this.words[i] = this.words[i + s]; } } else { this.words[0] = 0; this.length = 1; } var carry = 0; for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) { var word = this.words[i] | 0; this.words[i] = (carry << (26 - r)) | (word >>> r); carry = word & mask; } // Push carried bits as a mask if (maskedWords && carry !== 0) { maskedWords.words[maskedWords.length++] = carry; } if (this.length === 0) { this.words[0] = 0; this.length = 1; } return this._strip(); }; BN.prototype.ishrn = function ishrn (bits, hint, extended) { // TODO(indutny): implement me assert(this.negative === 0); return this.iushrn(bits, hint, extended); }; // Shift-left BN.prototype.shln = function shln (bits) { return this.clone().ishln(bits); }; BN.prototype.ushln = function ushln (bits) { return this.clone().iushln(bits); }; // Shift-right BN.prototype.shrn = function shrn (bits) { return this.clone().ishrn(bits); }; BN.prototype.ushrn = function ushrn (bits) { return this.clone().iushrn(bits); }; // Test if n bit is set BN.prototype.testn = function testn (bit) { assert(typeof bit === 'number' && bit >= 0); var r = bit % 26; var s = (bit - r) / 26; var q = 1 << r; // Fast case: bit is much higher than all existing words if (this.length <= s) return false; // Check bit and return var w = this.words[s]; return !!(w & q); }; // Return only lowers bits of number (in-place) BN.prototype.imaskn = function imaskn (bits) { assert(typeof bits === 'number' && bits >= 0); var r = bits % 26; var s = (bits - r) / 26; assert(this.negative === 0, 'imaskn works only with positive numbers'); if (this.length <= s) { return this; } if (r !== 0) { s++; } this.length = Math.min(s, this.length); if (r !== 0) { var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); this.words[this.length - 1] &= mask; } return this._strip(); }; // Return only lowers bits of number BN.prototype.maskn = function maskn (bits) { return this.clone().imaskn(bits); }; // Add plain number `num` to `this` BN.prototype.iaddn = function iaddn (num) { assert(typeof num === 'number'); assert(num < 0x4000000); if (num < 0) return this.isubn(-num); // Possible sign change if (this.negative !== 0) { if (this.length === 1 && (this.words[0] | 0) <= num) { this.words[0] = num - (this.words[0] | 0); this.negative = 0; return this; } this.negative = 0; this.isubn(num); this.negative = 1; return this; } // Add without checks return this._iaddn(num); }; BN.prototype._iaddn = function _iaddn (num) { this.words[0] += num; // Carry for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) { this.words[i] -= 0x4000000; if (i === this.length - 1) { this.words[i + 1] = 1; } else { this.words[i + 1]++; } } this.length = Math.max(this.length, i + 1); return this; }; // Subtract plain number `num` from `this` BN.prototype.isubn = function isubn (num) { assert(typeof num === 'number'); assert(num < 0x4000000); if (num < 0) return this.iaddn(-num); if (this.negative !== 0) { this.negative = 0; this.iaddn(num); this.negative = 1; return this; } this.words[0] -= num; if (this.length === 1 && this.words[0] < 0) { this.words[0] = -this.words[0]; this.negative = 1; } else { // Carry for (var i = 0; i < this.length && this.words[i] < 0; i++) { this.words[i] += 0x4000000; this.words[i + 1] -= 1; } } return this._strip(); }; BN.prototype.addn = function addn (num) { return this.clone().iaddn(num); }; BN.prototype.subn = function subn (num) { return this.clone().isubn(num); }; BN.prototype.iabs = function iabs () { this.negative = 0; return this; }; BN.prototype.abs = function abs () { return this.clone().iabs(); }; BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) { var len = num.length + shift; var i; this._expand(len); var w; var carry = 0; for (i = 0; i < num.length; i++) { w = (this.words[i + shift] | 0) + carry; var right = (num.words[i] | 0) * mul; w -= right & 0x3ffffff; carry = (w >> 26) - ((right / 0x4000000) | 0); this.words[i + shift] = w & 0x3ffffff; } for (; i < this.length - shift; i++) { w = (this.words[i + shift] | 0) + carry; carry = w >> 26; this.words[i + shift] = w & 0x3ffffff; } if (carry === 0) return this._strip(); // Subtraction overflow assert(carry === -1); carry = 0; for (i = 0; i < this.length; i++) { w = -(this.words[i] | 0) + carry; carry = w >> 26; this.words[i] = w & 0x3ffffff; } this.negative = 1; return this._strip(); }; BN.prototype._wordDiv = function _wordDiv (num, mode) { var shift = this.length - num.length; var a = this.clone(); var b = num; // Normalize var bhi = b.words[b.length - 1] | 0; var bhiBits = this._countBits(bhi); shift = 26 - bhiBits; if (shift !== 0) { b = b.ushln(shift); a.iushln(shift); bhi = b.words[b.length - 1] | 0; } // Initialize quotient var m = a.length - b.length; var q; if (mode !== 'mod') { q = new BN(null); q.length = m + 1; q.words = new Array(q.length); for (var i = 0; i < q.length; i++) { q.words[i] = 0; } } var diff = a.clone()._ishlnsubmul(b, 1, m); if (diff.negative === 0) { a = diff; if (q) { q.words[m] = 1; } } for (var j = m - 1; j >= 0; j--) { var qj = (a.words[b.length + j] | 0) * 0x4000000 + (a.words[b.length + j - 1] | 0); // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max // (0x7ffffff) qj = Math.min((qj / bhi) | 0, 0x3ffffff); a._ishlnsubmul(b, qj, j); while (a.negative !== 0) { qj--; a.negative = 0; a._ishlnsubmul(b, 1, j); if (!a.isZero()) { a.negative ^= 1; } } if (q) { q.words[j] = qj; } } if (q) { q._strip(); } a._strip(); // Denormalize if (mode !== 'div' && shift !== 0) { a.iushrn(shift); } return { div: q || null, mod: a }; }; // NOTE: 1) `mode` can be set to `mod` to request mod only, // to `div` to request div only, or be absent to // request both div & mod // 2) `positive` is true if unsigned mod is requested BN.prototype.divmod = function divmod (num, mode, positive) { assert(!num.isZero()); if (this.isZero()) { return { div: new BN(0), mod: new BN(0) }; } var div, mod, res; if (this.negative !== 0 && num.negative === 0) { res = this.neg().divmod(num, mode); if (mode !== 'mod') { div = res.div.neg(); } if (mode !== 'div') { mod = res.mod.neg(); if (positive && mod.negative !== 0) { mod.iadd(num); } } return { div: div, mod: mod }; } if (this.negative === 0 && num.negative !== 0) { res = this.divmod(num.neg(), mode); if (mode !== 'mod') { div = res.div.neg(); } return { div: div, mod: res.mod }; } if ((this.negative & num.negative) !== 0) { res = this.neg().divmod(num.neg(), mode); if (mode !== 'div') { mod = res.mod.neg(); if (positive && mod.negative !== 0) { mod.isub(num); } } return { div: res.div, mod: mod }; } // Both numbers are positive at this point // Strip both numbers to approximate shift value if (num.length > this.length || this.cmp(num) < 0) { return { div: new BN(0), mod: this }; } // Very short reduction if (num.length === 1) { if (mode === 'div') { return { div: this.divn(num.words[0]), mod: null }; } if (mode === 'mod') { return { div: null, mod: new BN(this.modrn(num.words[0])) }; } return { div: this.divn(num.words[0]), mod: new BN(this.modrn(num.words[0])) }; } return this._wordDiv(num, mode); }; // Find `this` / `num` BN.prototype.div = function div (num) { return this.divmod(num, 'div', false).div; }; // Find `this` % `num` BN.prototype.mod = function mod (num) { return this.divmod(num, 'mod', false).mod; }; BN.prototype.umod = function umod (num) { return this.divmod(num, 'mod', true).mod; }; // Find Round(`this` / `num`) BN.prototype.divRound = function divRound (num) { var dm = this.divmod(num); // Fast case - exact division if (dm.mod.isZero()) return dm.div; var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod; var half = num.ushrn(1); var r2 = num.andln(1); var cmp = mod.cmp(half); // Round down if (cmp < 0 || (r2 === 1 && cmp === 0)) return dm.div; // Round up return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1); }; BN.prototype.modrn = function modrn (num) { var isNegNum = num < 0; if (isNegNum) num = -num; assert(num <= 0x3ffffff); var p = (1 << 26) % num; var acc = 0; for (var i = this.length - 1; i >= 0; i--) { acc = (p * acc + (this.words[i] | 0)) % num; } return isNegNum ? -acc : acc; }; // WARNING: DEPRECATED BN.prototype.modn = function modn (num) { return this.modrn(num); }; // In-place division by number BN.prototype.idivn = function idivn (num) { var isNegNum = num < 0; if (isNegNum) num = -num; assert(num <= 0x3ffffff); var carry = 0; for (var i = this.length - 1; i >= 0; i--) { var w = (this.words[i] | 0) + carry * 0x4000000; this.words[i] = (w / num) | 0; carry = w % num; } this._strip(); return isNegNum ? this.ineg() : this; }; BN.prototype.divn = function divn (num) { return this.clone().idivn(num); }; BN.prototype.egcd = function egcd (p) { assert(p.negative === 0); assert(!p.isZero()); var x = this; var y = p.clone(); if (x.negative !== 0) { x = x.umod(p); } else { x = x.clone(); } // A * x + B * y = x var A = new BN(1); var B = new BN(0); // C * x + D * y = y var C = new BN(0); var D = new BN(1); var g = 0; while (x.isEven() && y.isEven()) { x.iushrn(1); y.iushrn(1); ++g; } var yp = y.clone(); var xp = x.clone(); while (!x.isZero()) { for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1); if (i > 0) { x.iushrn(i); while (i-- > 0) { if (A.isOdd() || B.isOdd()) { A.iadd(yp); B.isub(xp); } A.iushrn(1); B.iushrn(1); } } for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); if (j > 0) { y.iushrn(j); while (j-- > 0) { if (C.isOdd() || D.isOdd()) { C.iadd(yp); D.isub(xp); } C.iushrn(1); D.iushrn(1); } } if (x.cmp(y) >= 0) { x.isub(y); A.isub(C); B.isub(D); } else { y.isub(x); C.isub(A); D.isub(B); } } return { a: C, b: D, gcd: y.iushln(g) }; }; // This is reduced incarnation of the binary EEA // above, designated to invert members of the // _prime_ fields F(p) at a maximal speed BN.prototype._invmp = function _invmp (p) { assert(p.negative === 0); assert(!p.isZero()); var a = this; var b = p.clone(); if (a.negative !== 0) { a = a.umod(p); } else { a = a.clone(); } var x1 = new BN(1); var x2 = new BN(0); var delta = b.clone(); while (a.cmpn(1) > 0 && b.cmpn(1) > 0) { for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1); if (i > 0) { a.iushrn(i); while (i-- > 0) { if (x1.isOdd()) { x1.iadd(delta); } x1.iushrn(1); } } for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); if (j > 0) { b.iushrn(j); while (j-- > 0) { if (x2.isOdd()) { x2.iadd(delta); } x2.iushrn(1); } } if (a.cmp(b) >= 0) { a.isub(b); x1.isub(x2); } else { b.isub(a); x2.isub(x1); } } var res; if (a.cmpn(1) === 0) { res = x1; } else { res = x2; } if (res.cmpn(0) < 0) { res.iadd(p); } return res; }; BN.prototype.gcd = function gcd (num) { if (this.isZero()) return num.abs(); if (num.isZero()) return this.abs(); var a = this.clone(); var b = num.clone(); a.negative = 0; b.negative = 0; // Remove common factor of two for (var shift = 0; a.isEven() && b.isEven(); shift++) { a.iushrn(1); b.iushrn(1); } do { while (a.isEven()) { a.iushrn(1); } while (b.isEven()) { b.iushrn(1); } var r = a.cmp(b); if (r < 0) { // Swap `a` and `b` to make `a` always bigger than `b` var t = a; a = b; b = t; } else if (r === 0 || b.cmpn(1) === 0) { break; } a.isub(b); } while (true); return b.iushln(shift); }; // Invert number in the field F(num) BN.prototype.invm = function invm (num) { return this.egcd(num).a.umod(num); }; BN.prototype.isEven = function isEven () { return (this.words[0] & 1) === 0; }; BN.prototype.isOdd = function isOdd () { return (this.words[0] & 1) === 1; }; // And first word and num BN.prototype.andln = function andln (num) { return this.words[0] & num; }; // Increment at the bit position in-line BN.prototype.bincn = function bincn (bit) { assert(typeof bit === 'number'); var r = bit % 26; var s = (bit - r) / 26; var q = 1 << r; // Fast case: bit is much higher than all existing words if (this.length <= s) { this._expand(s + 1); this.words[s] |= q; return this; } // Add bit and propagate, if needed var carry = q; for (var i = s; carry !== 0 && i < this.length; i++) { var w = this.words[i] | 0; w += carry; carry = w >>> 26; w &= 0x3ffffff; this.words[i] = w; } if (carry !== 0) { this.words[i] = carry; this.length++; } return this; }; BN.prototype.isZero = function isZero () { return this.length === 1 && this.words[0] === 0; }; BN.prototype.cmpn = function cmpn (num) { var negative = num < 0; if (this.negative !== 0 && !negative) return -1; if (this.negative === 0 && negative) return 1; this._strip(); var res; if (this.length > 1) { res = 1; } else { if (negative) { num = -num; } assert(num <= 0x3ffffff, 'Number is too big'); var w = this.words[0] | 0; res = w === num ? 0 : w < num ? -1 : 1; } if (this.negative !== 0) return -res | 0; return res; }; // Compare two numbers and return: // 1 - if `this` > `num` // 0 - if `this` == `num` // -1 - if `this` < `num` BN.prototype.cmp = function cmp (num) { if (this.negative !== 0 && num.negative === 0) return -1; if (this.negative === 0 && num.negative !== 0) return 1; var res = this.ucmp(num); if (this.negative !== 0) return -res | 0; return res; }; // Unsigned comparison BN.prototype.ucmp = function ucmp (num) { // At this point both numbers have the same sign if (this.length > num.length) return 1; if (this.length < num.length) return -1; var res = 0; for (var i = this.length - 1; i >= 0; i--) { var a = this.words[i] | 0; var b = num.words[i] | 0; if (a === b) continue; if (a < b) { res = -1; } else if (a > b) { res = 1; } break; } return res; }; BN.prototype.gtn = function gtn (num) { return this.cmpn(num) === 1; }; BN.prototype.gt = function gt (num) { return this.cmp(num) === 1; }; BN.prototype.gten = function gten (num) { return this.cmpn(num) >= 0; }; BN.prototype.gte = function gte (num) { return this.cmp(num) >= 0; }; BN.prototype.ltn = function ltn (num) { return this.cmpn(num) === -1; }; BN.prototype.lt = function lt (num) { return this.cmp(num) === -1; }; BN.prototype.lten = function lten (num) { return this.cmpn(num) <= 0; }; BN.prototype.lte = function lte (num) { return this.cmp(num) <= 0; }; BN.prototype.eqn = function eqn (num) { return this.cmpn(num) === 0; }; BN.prototype.eq = function eq (num) { return this.cmp(num) === 0; }; // // A reduce context, could be using montgomery or something better, depending // on the `m` itself. // BN.red = function red (num) { return new Red(num); }; BN.prototype.toRed = function toRed (ctx) { assert(!this.red, 'Already a number in reduction context'); assert(this.negative === 0, 'red works only with positives'); return ctx.convertTo(this)._forceRed(ctx); }; BN.prototype.fromRed = function fromRed () { assert(this.red, 'fromRed works only with numbers in reduction context'); return this.red.convertFrom(this); }; BN.prototype._forceRed = function _forceRed (ctx) { this.red = ctx; return this; }; BN.prototype.forceRed = function forceRed (ctx) { assert(!this.red, 'Already a number in reduction context'); return this._forceRed(ctx); }; BN.prototype.redAdd = function redAdd (num) { assert(this.red, 'redAdd works only with red numbers'); return this.red.add(this, num); }; BN.prototype.redIAdd = function redIAdd (num) { assert(this.red, 'redIAdd works only with red numbers'); return this.red.iadd(this, num); }; BN.prototype.redSub = function redSub (num) { assert(this.red, 'redSub works only with red numbers'); return this.red.sub(this, num); }; BN.prototype.redISub = function redISub (num) { assert(this.red, 'redISub works only with red numbers'); return this.red.isub(this, num); }; BN.prototype.redShl = function redShl (num) { assert(this.red, 'redShl works only with red numbers'); return this.red.shl(this, num); }; BN.prototype.redMul = function redMul (num) { assert(this.red, 'redMul works only with red numbers'); this.red._verify2(this, num); return this.red.mul(this, num); }; BN.prototype.redIMul = function redIMul (num) { assert(this.red, 'redMul works only with red numbers'); this.red._verify2(this, num); return this.red.imul(this, num); }; BN.prototype.redSqr = function redSqr () { assert(this.red, 'redSqr works only with red numbers'); this.red._verify1(this); return this.red.sqr(this); }; BN.prototype.redISqr = function redISqr () { assert(this.red, 'redISqr works only with red numbers'); this.red._verify1(this); return this.red.isqr(this); }; // Square root over p BN.prototype.redSqrt = function redSqrt () { assert(this.red, 'redSqrt works only with red numbers'); this.red._verify1(this); return this.red.sqrt(this); }; BN.prototype.redInvm = function redInvm () { assert(this.red, 'redInvm works only with red numbers'); this.red._verify1(this); return this.red.invm(this); }; // Return negative clone of `this` % `red modulo` BN.prototype.redNeg = function redNeg () { assert(this.red, 'redNeg works only with red numbers'); this.red._verify1(this); return this.red.neg(this); }; BN.prototype.redPow = function redPow (num) { assert(this.red && !num.red, 'redPow(normalNum)'); this.red._verify1(this); return this.red.pow(this, num); }; // Prime numbers with efficient reduction var primes = { k256: null, p224: null, p192: null, p25519: null }; // Pseudo-Mersenne prime function MPrime (name, p) { // P = 2 ^ N - K this.name = name; this.p = new BN(p, 16); this.n = this.p.bitLength(); this.k = new BN(1).iushln(this.n).isub(this.p); this.tmp = this._tmp(); } MPrime.prototype._tmp = function _tmp () { var tmp = new BN(null); tmp.words = new Array(Math.ceil(this.n / 13)); return tmp; }; MPrime.prototype.ireduce = function ireduce (num) { // Assumes that `num` is less than `P^2` // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P) var r = num; var rlen; do { this.split(r, this.tmp); r = this.imulK(r); r = r.iadd(this.tmp); rlen = r.bitLength(); } while (rlen > this.n); var cmp = rlen < this.n ? -1 : r.ucmp(this.p); if (cmp === 0) { r.words[0] = 0; r.length = 1; } else if (cmp > 0) { r.isub(this.p); } else { if (r.strip !== undefined) { // r is a BN v4 instance r.strip(); } else { // r is a BN v5 instance r._strip(); } } return r; }; MPrime.prototype.split = function split (input, out) { input.iushrn(this.n, 0, out); }; MPrime.prototype.imulK = function imulK (num) { return num.imul(this.k); }; function K256 () { MPrime.call( this, 'k256', 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f'); } inherits(K256, MPrime); K256.prototype.split = function split (input, output) { // 256 = 9 * 26 + 22 var mask = 0x3fffff; var outLen = Math.min(input.length, 9); for (var i = 0; i < outLen; i++) { output.words[i] = input.words[i]; } output.length = outLen; if (input.length <= 9) { input.words[0] = 0; input.length = 1; return; } // Shift by 9 limbs var prev = input.words[9]; output.words[output.length++] = prev & mask; for (i = 10; i < input.length; i++) { var next = input.words[i] | 0; input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22); prev = next; } prev >>>= 22; input.words[i - 10] = prev; if (prev === 0 && input.length > 10) { input.length -= 10; } else { input.length -= 9; } }; K256.prototype.imulK = function imulK (num) { // K = 0x1000003d1 = [ 0x40, 0x3d1 ] num.words[num.length] = 0; num.words[num.length + 1] = 0; num.length += 2; // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390 var lo = 0; for (var i = 0; i < num.length; i++) { var w = num.words[i] | 0; lo += w * 0x3d1; num.words[i] = lo & 0x3ffffff; lo = w * 0x40 + ((lo / 0x4000000) | 0); } // Fast length reduction if (num.words[num.length - 1] === 0) { num.length--; if (num.words[num.length - 1] === 0) { num.length--; } } return num; }; function P224 () { MPrime.call( this, 'p224', 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001'); } inherits(P224, MPrime); function P192 () { MPrime.call( this, 'p192', 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff'); } inherits(P192, MPrime); function P25519 () { // 2 ^ 255 - 19 MPrime.call( this, '25519', '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed'); } inherits(P25519, MPrime); P25519.prototype.imulK = function imulK (num) { // K = 0x13 var carry = 0; for (var i = 0; i < num.length; i++) { var hi = (num.words[i] | 0) * 0x13 + carry; var lo = hi & 0x3ffffff; hi >>>= 26; num.words[i] = lo; carry = hi; } if (carry !== 0) { num.words[num.length++] = carry; } return num; }; // Exported mostly for testing purposes, use plain name instead BN._prime = function prime (name) { // Cached version of prime if (primes[name]) return primes[name]; var prime; if (name === 'k256') { prime = new K256(); } else if (name === 'p224') { prime = new P224(); } else if (name === 'p192') { prime = new P192(); } else if (name === 'p25519') { prime = new P25519(); } else { throw new Error('Unknown prime ' + name); } primes[name] = prime; return prime; }; // // Base reduction engine // function Red (m) { if (typeof m === 'string') { var prime = BN._prime(m); this.m = prime.p; this.prime = prime; } else { assert(m.gtn(1), 'modulus must be greater than 1'); this.m = m; this.prime = null; } } Red.prototype._verify1 = function _verify1 (a) { assert(a.negative === 0, 'red works only with positives'); assert(a.red, 'red works only with red numbers'); }; Red.prototype._verify2 = function _verify2 (a, b) { assert((a.negative | b.negative) === 0, 'red works only with positives'); assert(a.red && a.red === b.red, 'red works only with red numbers'); }; Red.prototype.imod = function imod (a) { if (this.prime) return this.prime.ireduce(a)._forceRed(this); move(a, a.umod(this.m)._forceRed(this)); return a; }; Red.prototype.neg = function neg (a) { if (a.isZero()) { return a.clone(); } return this.m.sub(a)._forceRed(this); }; Red.prototype.add = function add (a, b) { this._verify2(a, b); var res = a.add(b); if (res.cmp(this.m) >= 0) { res.isub(this.m); } return res._forceRed(this); }; Red.prototype.iadd = function iadd (a, b) { this._verify2(a, b); var res = a.iadd(b); if (res.cmp(this.m) >= 0) { res.isub(this.m); } return res; }; Red.prototype.sub = function sub (a, b) { this._verify2(a, b); var res = a.sub(b); if (res.cmpn(0) < 0) { res.iadd(this.m); } return res._forceRed(this); }; Red.prototype.isub = function isub (a, b) { this._verify2(a, b); var res = a.isub(b); if (res.cmpn(0) < 0) { res.iadd(this.m); } return res; }; Red.prototype.shl = function shl (a, num) { this._verify1(a); return this.imod(a.ushln(num)); }; Red.prototype.imul = function imul (a, b) { this._verify2(a, b); return this.imod(a.imul(b)); }; Red.prototype.mul = function mul (a, b) { this._verify2(a, b); return this.imod(a.mul(b)); }; Red.prototype.isqr = function isqr (a) { return this.imul(a, a.clone()); }; Red.prototype.sqr = function sqr (a) { return this.mul(a, a); }; Red.prototype.sqrt = function sqrt (a) { if (a.isZero()) return a.clone(); var mod3 = this.m.andln(3); assert(mod3 % 2 === 1); // Fast case if (mod3 === 3) { var pow = this.m.add(new BN(1)).iushrn(2); return this.pow(a, pow); } // Tonelli-Shanks algorithm (Totally unoptimized and slow) // // Find Q and S, that Q * 2 ^ S = (P - 1) var q = this.m.subn(1); var s = 0; while (!q.isZero() && q.andln(1) === 0) { s++; q.iushrn(1); } assert(!q.isZero()); var one = new BN(1).toRed(this); var nOne = one.redNeg(); // Find quadratic non-residue // NOTE: Max is such because of generalized Riemann hypothesis. var lpow = this.m.subn(1).iushrn(1); var z = this.m.bitLength(); z = new BN(2 * z * z).toRed(this); while (this.pow(z, lpow).cmp(nOne) !== 0) { z.redIAdd(nOne); } var c = this.pow(z, q); var r = this.pow(a, q.addn(1).iushrn(1)); var t = this.pow(a, q); var m = s; while (t.cmp(one) !== 0) { var tmp = t; for (var i = 0; tmp.cmp(one) !== 0; i++) { tmp = tmp.redSqr(); } assert(i < m); var b = this.pow(c, new BN(1).iushln(m - i - 1)); r = r.redMul(b); c = b.redSqr(); t = t.redMul(c); m = i; } return r; }; Red.prototype.invm = function invm (a) { var inv = a._invmp(this.m); if (inv.negative !== 0) { inv.negative = 0; return this.imod(inv).redNeg(); } else { return this.imod(inv); } }; Red.prototype.pow = function pow (a, num) { if (num.isZero()) return new BN(1).toRed(this); if (num.cmpn(1) === 0) return a.clone(); var windowSize = 4; var wnd = new Array(1 << windowSize); wnd[0] = new BN(1).toRed(this); wnd[1] = a; for (var i = 2; i < wnd.length; i++) { wnd[i] = this.mul(wnd[i - 1], a); } var res = wnd[0]; var current = 0; var currentLen = 0; var start = num.bitLength() % 26; if (start === 0) { start = 26; } for (i = num.length - 1; i >= 0; i--) { var word = num.words[i]; for (var j = start - 1; j >= 0; j--) { var bit = (word >> j) & 1; if (res !== wnd[0]) { res = this.sqr(res); } if (bit === 0 && current === 0) { currentLen = 0; continue; } current <<= 1; current |= bit; currentLen++; if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue; res = this.mul(res, wnd[current]); currentLen = 0; current = 0; } start = 26; } return res; }; Red.prototype.convertTo = function convertTo (num) { var r = num.umod(this.m); return r === num ? r.clone() : r; }; Red.prototype.convertFrom = function convertFrom (num) { var res = num.clone(); res.red = null; return res; }; // // Montgomery method engine // BN.mont = function mont (num) { return new Mont(num); }; function Mont (m) { Red.call(this, m); this.shift = this.m.bitLength(); if (this.shift % 26 !== 0) { this.shift += 26 - (this.shift % 26); } this.r = new BN(1).iushln(this.shift); this.r2 = this.imod(this.r.sqr()); this.rinv = this.r._invmp(this.m); this.minv = this.rinv.mul(this.r).isubn(1).div(this.m); this.minv = this.minv.umod(this.r); this.minv = this.r.sub(this.minv); } inherits(Mont, Red); Mont.prototype.convertTo = function convertTo (num) { return this.imod(num.ushln(this.shift)); }; Mont.prototype.convertFrom = function convertFrom (num) { var r = this.imod(num.mul(this.rinv)); r.red = null; return r; }; Mont.prototype.imul = function imul (a, b) { if (a.isZero() || b.isZero()) { a.words[0] = 0; a.length = 1; return a; } var t = a.imul(b); var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); var u = t.isub(c).iushrn(this.shift); var res = u; if (u.cmp(this.m) >= 0) { res = u.isub(this.m); } else if (u.cmpn(0) < 0) { res = u.iadd(this.m); } return res._forceRed(this); }; Mont.prototype.mul = function mul (a, b) { if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this); var t = a.mul(b); var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); var u = t.isub(c).iushrn(this.shift); var res = u; if (u.cmp(this.m) >= 0) { res = u.isub(this.m); } else if (u.cmpn(0) < 0) { res = u.iadd(this.m); } return res._forceRed(this); }; Mont.prototype.invm = function invm (a) { // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R var res = this.imod(a._invmp(this.m).mul(this.r2)); return res._forceRed(this); }; })( false || module, this); /***/ }), /***/ 16441: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { "arrayify": function() { return /* binding */ arrayify; }, "concat": function() { return /* binding */ concat; }, "hexConcat": function() { return /* binding */ hexConcat; }, "hexDataLength": function() { return /* binding */ hexDataLength; }, "hexDataSlice": function() { return /* binding */ hexDataSlice; }, "hexStripZeros": function() { return /* binding */ hexStripZeros; }, "hexValue": function() { return /* binding */ hexValue; }, "hexZeroPad": function() { return /* binding */ hexZeroPad; }, "hexlify": function() { return /* binding */ hexlify; }, "isBytes": function() { return /* binding */ isBytes; }, "isBytesLike": function() { return /* binding */ isBytesLike; }, "isHexString": function() { return /* binding */ isHexString; }, "joinSignature": function() { return /* binding */ joinSignature; }, "splitSignature": function() { return /* binding */ splitSignature; }, "stripZeros": function() { return /* binding */ stripZeros; }, "zeroPad": function() { return /* binding */ zeroPad; } }); // EXTERNAL MODULE: ./node_modules/@ethersproject/logger/lib.esm/index.js + 1 modules var lib_esm = __webpack_require__(1581); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/bytes/lib.esm/_version.js const version = "bytes/5.6.1"; //# sourceMappingURL=_version.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/bytes/lib.esm/index.js const logger = new lib_esm.Logger(version); /////////////////////////////// function isHexable(value) { return !!(value.toHexString); } function addSlice(array) { if (array.slice) { return array; } array.slice = function () { const args = Array.prototype.slice.call(arguments); return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args))); }; return array; } function isBytesLike(value) { return ((isHexString(value) && !(value.length % 2)) || isBytes(value)); } function isInteger(value) { return (typeof (value) === "number" && value == value && (value % 1) === 0); } function isBytes(value) { if (value == null) { return false; } if (value.constructor === Uint8Array) { return true; } if (typeof (value) === "string") { return false; } if (!isInteger(value.length) || value.length < 0) { return false; } for (let i = 0; i < value.length; i++) { const v = value[i]; if (!isInteger(v) || v < 0 || v >= 256) { return false; } } return true; } function arrayify(value, options) { if (!options) { options = {}; } if (typeof (value) === "number") { logger.checkSafeUint53(value, "invalid arrayify value"); const result = []; while (value) { result.unshift(value & 0xff); value = parseInt(String(value / 256)); } if (result.length === 0) { result.push(0); } return addSlice(new Uint8Array(result)); } if (options.allowMissingPrefix && typeof (value) === "string" && value.substring(0, 2) !== "0x") { value = "0x" + value; } if (isHexable(value)) { value = value.toHexString(); } if (isHexString(value)) { let hex = value.substring(2); if (hex.length % 2) { if (options.hexPad === "left") { hex = "0" + hex; } else if (options.hexPad === "right") { hex += "0"; } else { logger.throwArgumentError("hex data is odd-length", "value", value); } } const result = []; for (let i = 0; i < hex.length; i += 2) { result.push(parseInt(hex.substring(i, i + 2), 16)); } return addSlice(new Uint8Array(result)); } if (isBytes(value)) { return addSlice(new Uint8Array(value)); } return logger.throwArgumentError("invalid arrayify value", "value", value); } function concat(items) { const objects = items.map(item => arrayify(item)); const length = objects.reduce((accum, item) => (accum + item.length), 0); const result = new Uint8Array(length); objects.reduce((offset, object) => { result.set(object, offset); return offset + object.length; }, 0); return addSlice(result); } function stripZeros(value) { let result = arrayify(value); if (result.length === 0) { return result; } // Find the first non-zero entry let start = 0; while (start < result.length && result[start] === 0) { start++; } // If we started with zeros, strip them if (start) { result = result.slice(start); } return result; } function zeroPad(value, length) { value = arrayify(value); if (value.length > length) { logger.throwArgumentError("value out of range", "value", arguments[0]); } const result = new Uint8Array(length); result.set(value, length - value.length); return addSlice(result); } function isHexString(value, length) { if (typeof (value) !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) { return false; } if (length && value.length !== 2 + 2 * length) { return false; } return true; } const HexCharacters = "0123456789abcdef"; function hexlify(value, options) { if (!options) { options = {}; } if (typeof (value) === "number") { logger.checkSafeUint53(value, "invalid hexlify value"); let hex = ""; while (value) { hex = HexCharacters[value & 0xf] + hex; value = Math.floor(value / 16); } if (hex.length) { if (hex.length % 2) { hex = "0" + hex; } return "0x" + hex; } return "0x00"; } if (typeof (value) === "bigint") { value = value.toString(16); if (value.length % 2) { return ("0x0" + value); } return "0x" + value; } if (options.allowMissingPrefix && typeof (value) === "string" && value.substring(0, 2) !== "0x") { value = "0x" + value; } if (isHexable(value)) { return value.toHexString(); } if (isHexString(value)) { if (value.length % 2) { if (options.hexPad === "left") { value = "0x0" + value.substring(2); } else if (options.hexPad === "right") { value += "0"; } else { logger.throwArgumentError("hex data is odd-length", "value", value); } } return value.toLowerCase(); } if (isBytes(value)) { let result = "0x"; for (let i = 0; i < value.length; i++) { let v = value[i]; result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f]; } return result; } return logger.throwArgumentError("invalid hexlify value", "value", value); } /* function unoddify(value: BytesLike | Hexable | number): BytesLike | Hexable | number { if (typeof(value) === "string" && value.length % 2 && value.substring(0, 2) === "0x") { return "0x0" + value.substring(2); } return value; } */ function hexDataLength(data) { if (typeof (data) !== "string") { data = hexlify(data); } else if (!isHexString(data) || (data.length % 2)) { return null; } return (data.length - 2) / 2; } function hexDataSlice(data, offset, endOffset) { if (typeof (data) !== "string") { data = hexlify(data); } else if (!isHexString(data) || (data.length % 2)) { logger.throwArgumentError("invalid hexData", "value", data); } offset = 2 + 2 * offset; if (endOffset != null) { return "0x" + data.substring(offset, 2 + 2 * endOffset); } return "0x" + data.substring(offset); } function hexConcat(items) { let result = "0x"; items.forEach((item) => { result += hexlify(item).substring(2); }); return result; } function hexValue(value) { const trimmed = hexStripZeros(hexlify(value, { hexPad: "left" })); if (trimmed === "0x") { return "0x0"; } return trimmed; } function hexStripZeros(value) { if (typeof (value) !== "string") { value = hexlify(value); } if (!isHexString(value)) { logger.throwArgumentError("invalid hex string", "value", value); } value = value.substring(2); let offset = 0; while (offset < value.length && value[offset] === "0") { offset++; } return "0x" + value.substring(offset); } function hexZeroPad(value, length) { if (typeof (value) !== "string") { value = hexlify(value); } else if (!isHexString(value)) { logger.throwArgumentError("invalid hex string", "value", value); } if (value.length > 2 * length + 2) { logger.throwArgumentError("value out of range", "value", arguments[1]); } while (value.length < 2 * length + 2) { value = "0x0" + value.substring(2); } return value; } function splitSignature(signature) { const result = { r: "0x", s: "0x", _vs: "0x", recoveryParam: 0, v: 0, yParityAndS: "0x", compact: "0x" }; if (isBytesLike(signature)) { let bytes = arrayify(signature); // Get the r, s and v if (bytes.length === 64) { // EIP-2098; pull the v from the top bit of s and clear it result.v = 27 + (bytes[32] >> 7); bytes[32] &= 0x7f; result.r = hexlify(bytes.slice(0, 32)); result.s = hexlify(bytes.slice(32, 64)); } else if (bytes.length === 65) { result.r = hexlify(bytes.slice(0, 32)); result.s = hexlify(bytes.slice(32, 64)); result.v = bytes[64]; } else { logger.throwArgumentError("invalid signature string", "signature", signature); } // Allow a recid to be used as the v if (result.v < 27) { if (result.v === 0 || result.v === 1) { result.v += 27; } else { logger.throwArgumentError("signature invalid v byte", "signature", signature); } } // Compute recoveryParam from v result.recoveryParam = 1 - (result.v % 2); // Compute _vs from recoveryParam and s if (result.recoveryParam) { bytes[32] |= 0x80; } result._vs = hexlify(bytes.slice(32, 64)); } else { result.r = signature.r; result.s = signature.s; result.v = signature.v; result.recoveryParam = signature.recoveryParam; result._vs = signature._vs; // If the _vs is available, use it to populate missing s, v and recoveryParam // and verify non-missing s, v and recoveryParam if (result._vs != null) { const vs = zeroPad(arrayify(result._vs), 32); result._vs = hexlify(vs); // Set or check the recid const recoveryParam = ((vs[0] >= 128) ? 1 : 0); if (result.recoveryParam == null) { result.recoveryParam = recoveryParam; } else if (result.recoveryParam !== recoveryParam) { logger.throwArgumentError("signature recoveryParam mismatch _vs", "signature", signature); } // Set or check the s vs[0] &= 0x7f; const s = hexlify(vs); if (result.s == null) { result.s = s; } else if (result.s !== s) { logger.throwArgumentError("signature v mismatch _vs", "signature", signature); } } // Use recid and v to populate each other if (result.recoveryParam == null) { if (result.v == null) { logger.throwArgumentError("signature missing v and recoveryParam", "signature", signature); } else if (result.v === 0 || result.v === 1) { result.recoveryParam = result.v; } else { result.recoveryParam = 1 - (result.v % 2); } } else { if (result.v == null) { result.v = 27 + result.recoveryParam; } else { const recId = (result.v === 0 || result.v === 1) ? result.v : (1 - (result.v % 2)); if (result.recoveryParam !== recId) { logger.throwArgumentError("signature recoveryParam mismatch v", "signature", signature); } } } if (result.r == null || !isHexString(result.r)) { logger.throwArgumentError("signature missing or invalid r", "signature", signature); } else { result.r = hexZeroPad(result.r, 32); } if (result.s == null || !isHexString(result.s)) { logger.throwArgumentError("signature missing or invalid s", "signature", signature); } else { result.s = hexZeroPad(result.s, 32); } const vs = arrayify(result.s); if (vs[0] >= 128) { logger.throwArgumentError("signature s out of range", "signature", signature); } if (result.recoveryParam) { vs[0] |= 0x80; } const _vs = hexlify(vs); if (result._vs) { if (!isHexString(result._vs)) { logger.throwArgumentError("signature invalid _vs", "signature", signature); } result._vs = hexZeroPad(result._vs, 32); } // Set or check the _vs if (result._vs == null) { result._vs = _vs; } else if (result._vs !== _vs) { logger.throwArgumentError("signature _vs mismatch v and s", "signature", signature); } } result.yParityAndS = result._vs; result.compact = result.r + result.yParityAndS.substring(2); return result; } function joinSignature(signature) { signature = splitSignature(signature); return hexlify(concat([ signature.r, signature.s, (signature.recoveryParam ? "0x1c" : "0x1b") ])); } //# sourceMappingURL=index.js.map /***/ }), /***/ 9279: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "d": function() { return /* binding */ AddressZero; } /* harmony export */ }); const AddressZero = "0x0000000000000000000000000000000000000000"; //# sourceMappingURL=addresses.js.map /***/ }), /***/ 21046: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "$B": function() { return /* binding */ MinInt256; }, /* harmony export */ "Bz": function() { return /* binding */ MaxUint256; }, /* harmony export */ "Ce": function() { return /* binding */ WeiPerEther; }, /* harmony export */ "PS": function() { return /* binding */ MaxInt256; }, /* harmony export */ "Py": function() { return /* binding */ Two; }, /* harmony export */ "_Y": function() { return /* binding */ Zero; }, /* harmony export */ "fh": function() { return /* binding */ One; }, /* harmony export */ "tL": function() { return /* binding */ NegativeOne; } /* harmony export */ }); /* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2593); const NegativeOne = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__/* .BigNumber.from */ .O$.from(-1)); const Zero = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__/* .BigNumber.from */ .O$.from(0)); const One = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__/* .BigNumber.from */ .O$.from(1)); const Two = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__/* .BigNumber.from */ .O$.from(2)); const WeiPerEther = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__/* .BigNumber.from */ .O$.from("1000000000000000000")); const MaxUint256 = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__/* .BigNumber.from */ .O$.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")); const MinInt256 = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__/* .BigNumber.from */ .O$.from("-0x8000000000000000000000000000000000000000000000000000000000000000")); const MaxInt256 = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__/* .BigNumber.from */ .O$.from("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")); //# sourceMappingURL=bignumbers.js.map /***/ }), /***/ 57218: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "R": function() { return /* binding */ HashZero; } /* harmony export */ }); const HashZero = "0x0000000000000000000000000000000000000000000000000000000000000000"; //# sourceMappingURL=hashes.js.map /***/ }), /***/ 21815: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { "AddressZero": function() { return /* reexport */ addresses/* AddressZero */.d; }, "EtherSymbol": function() { return /* reexport */ EtherSymbol; }, "HashZero": function() { return /* reexport */ hashes/* HashZero */.R; }, "MaxInt256": function() { return /* reexport */ bignumbers/* MaxInt256 */.PS; }, "MaxUint256": function() { return /* reexport */ bignumbers/* MaxUint256 */.Bz; }, "MinInt256": function() { return /* reexport */ bignumbers/* MinInt256 */.$B; }, "NegativeOne": function() { return /* reexport */ bignumbers/* NegativeOne */.tL; }, "One": function() { return /* reexport */ bignumbers/* One */.fh; }, "Two": function() { return /* reexport */ bignumbers/* Two */.Py; }, "WeiPerEther": function() { return /* reexport */ bignumbers/* WeiPerEther */.Ce; }, "Zero": function() { return /* reexport */ bignumbers/* Zero */._Y; } }); // EXTERNAL MODULE: ./node_modules/@ethersproject/constants/lib.esm/addresses.js var addresses = __webpack_require__(9279); // EXTERNAL MODULE: ./node_modules/@ethersproject/constants/lib.esm/bignumbers.js var bignumbers = __webpack_require__(21046); // EXTERNAL MODULE: ./node_modules/@ethersproject/constants/lib.esm/hashes.js var hashes = __webpack_require__(57218); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/constants/lib.esm/strings.js // NFKC (composed) // (decomposed) const EtherSymbol = "\u039e"; // "\uD835\uDF63"; //# sourceMappingURL=strings.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/constants/lib.esm/index.js //# sourceMappingURL=index.js.map /***/ }), /***/ 64146: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { "BaseContract": function() { return /* binding */ BaseContract; }, "Contract": function() { return /* binding */ Contract; }, "ContractFactory": function() { return /* binding */ ContractFactory; } }); // EXTERNAL MODULE: ./node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js var abstract_coder = __webpack_require__(61184); // EXTERNAL MODULE: ./node_modules/@ethersproject/abi/lib.esm/interface.js var lib_esm_interface = __webpack_require__(8198); // EXTERNAL MODULE: ./node_modules/@ethersproject/abstract-provider/lib.esm/index.js + 1 modules var lib_esm = __webpack_require__(81556); // EXTERNAL MODULE: ./node_modules/@ethersproject/abstract-signer/lib.esm/index.js + 1 modules var abstract_signer_lib_esm = __webpack_require__(48088); // EXTERNAL MODULE: ./node_modules/@ethersproject/address/lib.esm/index.js + 1 modules var address_lib_esm = __webpack_require__(19485); // EXTERNAL MODULE: ./node_modules/@ethersproject/bignumber/lib.esm/bignumber.js var bignumber = __webpack_require__(2593); // EXTERNAL MODULE: ./node_modules/@ethersproject/bytes/lib.esm/index.js + 1 modules var bytes_lib_esm = __webpack_require__(16441); // EXTERNAL MODULE: ./node_modules/@ethersproject/properties/lib.esm/index.js + 1 modules var properties_lib_esm = __webpack_require__(6881); // EXTERNAL MODULE: ./node_modules/@ethersproject/transactions/lib.esm/index.js + 1 modules var transactions_lib_esm = __webpack_require__(83875); // EXTERNAL MODULE: ./node_modules/@ethersproject/logger/lib.esm/index.js + 1 modules var logger_lib_esm = __webpack_require__(1581); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/contracts/lib.esm/_version.js const version = "contracts/5.6.2"; //# sourceMappingURL=_version.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/contracts/lib.esm/index.js var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; const logger = new logger_lib_esm.Logger(version); ; ; /////////////////////////////// const allowedTransactionKeys = { chainId: true, data: true, from: true, gasLimit: true, gasPrice: true, nonce: true, to: true, value: true, type: true, accessList: true, maxFeePerGas: true, maxPriorityFeePerGas: true, customData: true, ccipReadEnabled: true }; function resolveName(resolver, nameOrPromise) { return __awaiter(this, void 0, void 0, function* () { const name = yield nameOrPromise; if (typeof (name) !== "string") { logger.throwArgumentError("invalid address or ENS name", "name", name); } // If it is already an address, just use it (after adding checksum) try { return (0,address_lib_esm.getAddress)(name); } catch (error) { } if (!resolver) { logger.throwError("a provider or signer is needed to resolve ENS names", logger_lib_esm.Logger.errors.UNSUPPORTED_OPERATION, { operation: "resolveName" }); } const address = yield resolver.resolveName(name); if (address == null) { logger.throwArgumentError("resolver or addr is not configured for ENS name", "name", name); } return address; }); } // Recursively replaces ENS names with promises to resolve the name and resolves all properties function resolveAddresses(resolver, value, paramType) { return __awaiter(this, void 0, void 0, function* () { if (Array.isArray(paramType)) { return yield Promise.all(paramType.map((paramType, index) => { return resolveAddresses(resolver, ((Array.isArray(value)) ? value[index] : value[paramType.name]), paramType); })); } if (paramType.type === "address") { return yield resolveName(resolver, value); } if (paramType.type === "tuple") { return yield resolveAddresses(resolver, value, paramType.components); } if (paramType.baseType === "array") { if (!Array.isArray(value)) { return Promise.reject(logger.makeError("invalid value for array", logger_lib_esm.Logger.errors.INVALID_ARGUMENT, { argument: "value", value })); } return yield Promise.all(value.map((v) => resolveAddresses(resolver, v, paramType.arrayChildren))); } return value; }); } function populateTransaction(contract, fragment, args) { return __awaiter(this, void 0, void 0, function* () { // If an extra argument is given, it is overrides let overrides = {}; if (args.length === fragment.inputs.length + 1 && typeof (args[args.length - 1]) === "object") { overrides = (0,properties_lib_esm.shallowCopy)(args.pop()); } // Make sure the parameter count matches logger.checkArgumentCount(args.length, fragment.inputs.length, "passed to contract"); // Populate "from" override (allow promises) if (contract.signer) { if (overrides.from) { // Contracts with a Signer are from the Signer's frame-of-reference; // but we allow overriding "from" if it matches the signer overrides.from = (0,properties_lib_esm.resolveProperties)({ override: resolveName(contract.signer, overrides.from), signer: contract.signer.getAddress() }).then((check) => __awaiter(this, void 0, void 0, function* () { if ((0,address_lib_esm.getAddress)(check.signer) !== check.override) { logger.throwError("Contract with a Signer cannot override from", logger_lib_esm.Logger.errors.UNSUPPORTED_OPERATION, { operation: "overrides.from" }); } return check.override; })); } else { overrides.from = contract.signer.getAddress(); } } else if (overrides.from) { overrides.from = resolveName(contract.provider, overrides.from); //} else { // Contracts without a signer can override "from", and if // unspecified the zero address is used //overrides.from = AddressZero; } // Wait for all dependencies to be resolved (prefer the signer over the provider) const resolved = yield (0,properties_lib_esm.resolveProperties)({ args: resolveAddresses(contract.signer || contract.provider, args, fragment.inputs), address: contract.resolvedAddress, overrides: ((0,properties_lib_esm.resolveProperties)(overrides) || {}) }); // The ABI coded transaction const data = contract.interface.encodeFunctionData(fragment, resolved.args); const tx = { data: data, to: resolved.address }; // Resolved Overrides const ro = resolved.overrides; // Populate simple overrides if (ro.nonce != null) { tx.nonce = bignumber/* BigNumber.from */.O$.from(ro.nonce).toNumber(); } if (ro.gasLimit != null) { tx.gasLimit = bignumber/* BigNumber.from */.O$.from(ro.gasLimit); } if (ro.gasPrice != null) { tx.gasPrice = bignumber/* BigNumber.from */.O$.from(ro.gasPrice); } if (ro.maxFeePerGas != null) { tx.maxFeePerGas = bignumber/* BigNumber.from */.O$.from(ro.maxFeePerGas); } if (ro.maxPriorityFeePerGas != null) { tx.maxPriorityFeePerGas = bignumber/* BigNumber.from */.O$.from(ro.maxPriorityFeePerGas); } if (ro.from != null) { tx.from = ro.from; } if (ro.type != null) { tx.type = ro.type; } if (ro.accessList != null) { tx.accessList = (0,transactions_lib_esm.accessListify)(ro.accessList); } // If there was no "gasLimit" override, but the ABI specifies a default, use it if (tx.gasLimit == null && fragment.gas != null) { // Compute the intrinsic gas cost for this transaction // @TODO: This is based on the yellow paper as of Petersburg; this is something // we may wish to parameterize in v6 as part of the Network object. Since this // is always a non-nil to address, we can ignore G_create, but may wish to add // similar logic to the ContractFactory. let intrinsic = 21000; const bytes = (0,bytes_lib_esm.arrayify)(data); for (let i = 0; i < bytes.length; i++) { intrinsic += 4; if (bytes[i]) { intrinsic += 64; } } tx.gasLimit = bignumber/* BigNumber.from */.O$.from(fragment.gas).add(intrinsic); } // Populate "value" override if (ro.value) { const roValue = bignumber/* BigNumber.from */.O$.from(ro.value); if (!roValue.isZero() && !fragment.payable) { logger.throwError("non-payable method cannot override value", logger_lib_esm.Logger.errors.UNSUPPORTED_OPERATION, { operation: "overrides.value", value: overrides.value }); } tx.value = roValue; } if (ro.customData) { tx.customData = (0,properties_lib_esm.shallowCopy)(ro.customData); } if (ro.ccipReadEnabled) { tx.ccipReadEnabled = !!ro.ccipReadEnabled; } // Remove the overrides delete overrides.nonce; delete overrides.gasLimit; delete overrides.gasPrice; delete overrides.from; delete overrides.value; delete overrides.type; delete overrides.accessList; delete overrides.maxFeePerGas; delete overrides.maxPriorityFeePerGas; delete overrides.customData; delete overrides.ccipReadEnabled; // Make sure there are no stray overrides, which may indicate a // typo or using an unsupported key. const leftovers = Object.keys(overrides).filter((key) => (overrides[key] != null)); if (leftovers.length) { logger.throwError(`cannot override ${leftovers.map((l) => JSON.stringify(l)).join(",")}`, logger_lib_esm.Logger.errors.UNSUPPORTED_OPERATION, { operation: "overrides", overrides: leftovers }); } return tx; }); } function buildPopulate(contract, fragment) { return function (...args) { return populateTransaction(contract, fragment, args); }; } function buildEstimate(contract, fragment) { const signerOrProvider = (contract.signer || contract.provider); return function (...args) { return __awaiter(this, void 0, void 0, function* () { if (!signerOrProvider) { logger.throwError("estimate require a provider or signer", logger_lib_esm.Logger.errors.UNSUPPORTED_OPERATION, { operation: "estimateGas" }); } const tx = yield populateTransaction(contract, fragment, args); return yield signerOrProvider.estimateGas(tx); }); }; } function addContractWait(contract, tx) { const wait = tx.wait.bind(tx); tx.wait = (confirmations) => { return wait(confirmations).then((receipt) => { receipt.events = receipt.logs.map((log) => { let event = (0,properties_lib_esm.deepCopy)(log); let parsed = null; try { parsed = contract.interface.parseLog(log); } catch (e) { } // Successfully parsed the event log; include it if (parsed) { event.args = parsed.args; event.decode = (data, topics) => { return contract.interface.decodeEventLog(parsed.eventFragment, data, topics); }; event.event = parsed.name; event.eventSignature = parsed.signature; } // Useful operations event.removeListener = () => { return contract.provider; }; event.getBlock = () => { return contract.provider.getBlock(receipt.blockHash); }; event.getTransaction = () => { return contract.provider.getTransaction(receipt.transactionHash); }; event.getTransactionReceipt = () => { return Promise.resolve(receipt); }; return event; }); return receipt; }); }; } function buildCall(contract, fragment, collapseSimple) { const signerOrProvider = (contract.signer || contract.provider); return function (...args) { return __awaiter(this, void 0, void 0, function* () { // Extract the "blockTag" override if present let blockTag = undefined; if (args.length === fragment.inputs.length + 1 && typeof (args[args.length - 1]) === "object") { const overrides = (0,properties_lib_esm.shallowCopy)(args.pop()); if (overrides.blockTag != null) { blockTag = yield overrides.blockTag; } delete overrides.blockTag; args.push(overrides); } // If the contract was just deployed, wait until it is mined if (contract.deployTransaction != null) { yield contract._deployed(blockTag); } // Call a node and get the result const tx = yield populateTransaction(contract, fragment, args); const result = yield signerOrProvider.call(tx, blockTag); try { let value = contract.interface.decodeFunctionResult(fragment, result); if (collapseSimple && fragment.outputs.length === 1) { value = value[0]; } return value; } catch (error) { if (error.code === logger_lib_esm.Logger.errors.CALL_EXCEPTION) { error.address = contract.address; error.args = args; error.transaction = tx; } throw error; } }); }; } function buildSend(contract, fragment) { return function (...args) { return __awaiter(this, void 0, void 0, function* () { if (!contract.signer) { logger.throwError("sending a transaction requires a signer", logger_lib_esm.Logger.errors.UNSUPPORTED_OPERATION, { operation: "sendTransaction" }); } // If the contract was just deployed, wait until it is mined if (contract.deployTransaction != null) { yield contract._deployed(); } const txRequest = yield populateTransaction(contract, fragment, args); const tx = yield contract.signer.sendTransaction(txRequest); // Tweak the tx.wait so the receipt has extra properties addContractWait(contract, tx); return tx; }); }; } function buildDefault(contract, fragment, collapseSimple) { if (fragment.constant) { return buildCall(contract, fragment, collapseSimple); } return buildSend(contract, fragment); } function getEventTag(filter) { if (filter.address && (filter.topics == null || filter.topics.length === 0)) { return "*"; } return (filter.address || "*") + "@" + (filter.topics ? filter.topics.map((topic) => { if (Array.isArray(topic)) { return topic.join("|"); } return topic; }).join(":") : ""); } class RunningEvent { constructor(tag, filter) { (0,properties_lib_esm.defineReadOnly)(this, "tag", tag); (0,properties_lib_esm.defineReadOnly)(this, "filter", filter); this._listeners = []; } addListener(listener, once) { this._listeners.push({ listener: listener, once: once }); } removeListener(listener) { let done = false; this._listeners = this._listeners.filter((item) => { if (done || item.listener !== listener) { return true; } done = true; return false; }); } removeAllListeners() { this._listeners = []; } listeners() { return this._listeners.map((i) => i.listener); } listenerCount() { return this._listeners.length; } run(args) { const listenerCount = this.listenerCount(); this._listeners = this._listeners.filter((item) => { const argsCopy = args.slice(); // Call the callback in the next event loop setTimeout(() => { item.listener.apply(this, argsCopy); }, 0); // Reschedule it if it not "once" return !(item.once); }); return listenerCount; } prepareEvent(event) { } // Returns the array that will be applied to an emit getEmit(event) { return [event]; } } class ErrorRunningEvent extends RunningEvent { constructor() { super("error", null); } } // @TODO Fragment should inherit Wildcard? and just override getEmit? // or have a common abstract super class, with enough constructor // options to configure both. // A Fragment Event will populate all the properties that Wildcard // will, and additionally dereference the arguments when emitting class FragmentRunningEvent extends RunningEvent { constructor(address, contractInterface, fragment, topics) { const filter = { address: address }; let topic = contractInterface.getEventTopic(fragment); if (topics) { if (topic !== topics[0]) { logger.throwArgumentError("topic mismatch", "topics", topics); } filter.topics = topics.slice(); } else { filter.topics = [topic]; } super(getEventTag(filter), filter); (0,properties_lib_esm.defineReadOnly)(this, "address", address); (0,properties_lib_esm.defineReadOnly)(this, "interface", contractInterface); (0,properties_lib_esm.defineReadOnly)(this, "fragment", fragment); } prepareEvent(event) { super.prepareEvent(event); event.event = this.fragment.name; event.eventSignature = this.fragment.format(); event.decode = (data, topics) => { return this.interface.decodeEventLog(this.fragment, data, topics); }; try { event.args = this.interface.decodeEventLog(this.fragment, event.data, event.topics); } catch (error) { event.args = null; event.decodeError = error; } } getEmit(event) { const errors = (0,abstract_coder/* checkResultErrors */.BR)(event.args); if (errors.length) { throw errors[0].error; } const args = (event.args || []).slice(); args.push(event); return args; } } // A Wildcard Event will attempt to populate: // - event The name of the event name // - eventSignature The full signature of the event // - decode A function to decode data and topics // - args The decoded data and topics class WildcardRunningEvent extends RunningEvent { constructor(address, contractInterface) { super("*", { address: address }); (0,properties_lib_esm.defineReadOnly)(this, "address", address); (0,properties_lib_esm.defineReadOnly)(this, "interface", contractInterface); } prepareEvent(event) { super.prepareEvent(event); try { const parsed = this.interface.parseLog(event); event.event = parsed.name; event.eventSignature = parsed.signature; event.decode = (data, topics) => { return this.interface.decodeEventLog(parsed.eventFragment, data, topics); }; event.args = parsed.args; } catch (error) { // No matching event } } } class BaseContract { constructor(addressOrName, contractInterface, signerOrProvider) { // @TODO: Maybe still check the addressOrName looks like a valid address or name? //address = getAddress(address); (0,properties_lib_esm.defineReadOnly)(this, "interface", (0,properties_lib_esm.getStatic)(new.target, "getInterface")(contractInterface)); if (signerOrProvider == null) { (0,properties_lib_esm.defineReadOnly)(this, "provider", null); (0,properties_lib_esm.defineReadOnly)(this, "signer", null); } else if (abstract_signer_lib_esm.Signer.isSigner(signerOrProvider)) { (0,properties_lib_esm.defineReadOnly)(this, "provider", signerOrProvider.provider || null); (0,properties_lib_esm.defineReadOnly)(this, "signer", signerOrProvider); } else if (lib_esm.Provider.isProvider(signerOrProvider)) { (0,properties_lib_esm.defineReadOnly)(this, "provider", signerOrProvider); (0,properties_lib_esm.defineReadOnly)(this, "signer", null); } else { logger.throwArgumentError("invalid signer or provider", "signerOrProvider", signerOrProvider); } (0,properties_lib_esm.defineReadOnly)(this, "callStatic", {}); (0,properties_lib_esm.defineReadOnly)(this, "estimateGas", {}); (0,properties_lib_esm.defineReadOnly)(this, "functions", {}); (0,properties_lib_esm.defineReadOnly)(this, "populateTransaction", {}); (0,properties_lib_esm.defineReadOnly)(this, "filters", {}); { const uniqueFilters = {}; Object.keys(this.interface.events).forEach((eventSignature) => { const event = this.interface.events[eventSignature]; (0,properties_lib_esm.defineReadOnly)(this.filters, eventSignature, (...args) => { return { address: this.address, topics: this.interface.encodeFilterTopics(event, args) }; }); if (!uniqueFilters[event.name]) { uniqueFilters[event.name] = []; } uniqueFilters[event.name].push(eventSignature); }); Object.keys(uniqueFilters).forEach((name) => { const filters = uniqueFilters[name]; if (filters.length === 1) { (0,properties_lib_esm.defineReadOnly)(this.filters, name, this.filters[filters[0]]); } else { logger.warn(`Duplicate definition of ${name} (${filters.join(", ")})`); } }); } (0,properties_lib_esm.defineReadOnly)(this, "_runningEvents", {}); (0,properties_lib_esm.defineReadOnly)(this, "_wrappedEmits", {}); if (addressOrName == null) { logger.throwArgumentError("invalid contract address or ENS name", "addressOrName", addressOrName); } (0,properties_lib_esm.defineReadOnly)(this, "address", addressOrName); if (this.provider) { (0,properties_lib_esm.defineReadOnly)(this, "resolvedAddress", resolveName(this.provider, addressOrName)); } else { try { (0,properties_lib_esm.defineReadOnly)(this, "resolvedAddress", Promise.resolve((0,address_lib_esm.getAddress)(addressOrName))); } catch (error) { // Without a provider, we cannot use ENS names logger.throwError("provider is required to use ENS name as contract address", logger_lib_esm.Logger.errors.UNSUPPORTED_OPERATION, { operation: "new Contract" }); } } // Swallow bad ENS names to prevent Unhandled Exceptions this.resolvedAddress.catch((e) => { }); const uniqueNames = {}; const uniqueSignatures = {}; Object.keys(this.interface.functions).forEach((signature) => { const fragment = this.interface.functions[signature]; // Check that the signature is unique; if not the ABI generation has // not been cleaned or may be incorrectly generated if (uniqueSignatures[signature]) { logger.warn(`Duplicate ABI entry for ${JSON.stringify(signature)}`); return; } uniqueSignatures[signature] = true; // Track unique names; we only expose bare named functions if they // are ambiguous { const name = fragment.name; if (!uniqueNames[`%${name}`]) { uniqueNames[`%${name}`] = []; } uniqueNames[`%${name}`].push(signature); } if (this[signature] == null) { (0,properties_lib_esm.defineReadOnly)(this, signature, buildDefault(this, fragment, true)); } // We do not collapse simple calls on this bucket, which allows // frameworks to safely use this without introspection as well as // allows decoding error recovery. if (this.functions[signature] == null) { (0,properties_lib_esm.defineReadOnly)(this.functions, signature, buildDefault(this, fragment, false)); } if (this.callStatic[signature] == null) { (0,properties_lib_esm.defineReadOnly)(this.callStatic, signature, buildCall(this, fragment, true)); } if (this.populateTransaction[signature] == null) { (0,properties_lib_esm.defineReadOnly)(this.populateTransaction, signature, buildPopulate(this, fragment)); } if (this.estimateGas[signature] == null) { (0,properties_lib_esm.defineReadOnly)(this.estimateGas, signature, buildEstimate(this, fragment)); } }); Object.keys(uniqueNames).forEach((name) => { // Ambiguous names to not get attached as bare names const signatures = uniqueNames[name]; if (signatures.length > 1) { return; } // Strip off the leading "%" used for prototype protection name = name.substring(1); const signature = signatures[0]; // If overwriting a member property that is null, swallow the error try { if (this[name] == null) { (0,properties_lib_esm.defineReadOnly)(this, name, this[signature]); } } catch (e) { } if (this.functions[name] == null) { (0,properties_lib_esm.defineReadOnly)(this.functions, name, this.functions[signature]); } if (this.callStatic[name] == null) { (0,properties_lib_esm.defineReadOnly)(this.callStatic, name, this.callStatic[signature]); } if (this.populateTransaction[name] == null) { (0,properties_lib_esm.defineReadOnly)(this.populateTransaction, name, this.populateTransaction[signature]); } if (this.estimateGas[name] == null) { (0,properties_lib_esm.defineReadOnly)(this.estimateGas, name, this.estimateGas[signature]); } }); } static getContractAddress(transaction) { return (0,address_lib_esm.getContractAddress)(transaction); } static getInterface(contractInterface) { if (lib_esm_interface/* Interface.isInterface */.vU.isInterface(contractInterface)) { return contractInterface; } return new lib_esm_interface/* Interface */.vU(contractInterface); } // @TODO: Allow timeout? deployed() { return this._deployed(); } _deployed(blockTag) { if (!this._deployedPromise) { // If we were just deployed, we know the transaction we should occur in if (this.deployTransaction) { this._deployedPromise = this.deployTransaction.wait().then(() => { return this; }); } else { // @TODO: Once we allow a timeout to be passed in, we will wait // up to that many blocks for getCode // Otherwise, poll for our code to be deployed this._deployedPromise = this.provider.getCode(this.address, blockTag).then((code) => { if (code === "0x") { logger.throwError("contract not deployed", logger_lib_esm.Logger.errors.UNSUPPORTED_OPERATION, { contractAddress: this.address, operation: "getDeployed" }); } return this; }); } } return this._deployedPromise; } // @TODO: // estimateFallback(overrides?: TransactionRequest): Promise // @TODO: // estimateDeploy(bytecode: string, ...args): Promise fallback(overrides) { if (!this.signer) { logger.throwError("sending a transactions require a signer", logger_lib_esm.Logger.errors.UNSUPPORTED_OPERATION, { operation: "sendTransaction(fallback)" }); } const tx = (0,properties_lib_esm.shallowCopy)(overrides || {}); ["from", "to"].forEach(function (key) { if (tx[key] == null) { return; } logger.throwError("cannot override " + key, logger_lib_esm.Logger.errors.UNSUPPORTED_OPERATION, { operation: key }); }); tx.to = this.resolvedAddress; return this.deployed().then(() => { return this.signer.sendTransaction(tx); }); } // Reconnect to a different signer or provider connect(signerOrProvider) { if (typeof (signerOrProvider) === "string") { signerOrProvider = new abstract_signer_lib_esm.VoidSigner(signerOrProvider, this.provider); } const contract = new (this.constructor)(this.address, this.interface, signerOrProvider); if (this.deployTransaction) { (0,properties_lib_esm.defineReadOnly)(contract, "deployTransaction", this.deployTransaction); } return contract; } // Re-attach to a different on-chain instance of this contract attach(addressOrName) { return new (this.constructor)(addressOrName, this.interface, this.signer || this.provider); } static isIndexed(value) { return lib_esm_interface/* Indexed.isIndexed */.Hk.isIndexed(value); } _normalizeRunningEvent(runningEvent) { // Already have an instance of this event running; we can re-use it if (this._runningEvents[runningEvent.tag]) { return this._runningEvents[runningEvent.tag]; } return runningEvent; } _getRunningEvent(eventName) { if (typeof (eventName) === "string") { // Listen for "error" events (if your contract has an error event, include // the full signature to bypass this special event keyword) if (eventName === "error") { return this._normalizeRunningEvent(new ErrorRunningEvent()); } // Listen for any event that is registered if (eventName === "event") { return this._normalizeRunningEvent(new RunningEvent("event", null)); } // Listen for any event if (eventName === "*") { return this._normalizeRunningEvent(new WildcardRunningEvent(this.address, this.interface)); } // Get the event Fragment (throws if ambiguous/unknown event) const fragment = this.interface.getEvent(eventName); return this._normalizeRunningEvent(new FragmentRunningEvent(this.address, this.interface, fragment)); } // We have topics to filter by... if (eventName.topics && eventName.topics.length > 0) { // Is it a known topichash? (throws if no matching topichash) try { const topic = eventName.topics[0]; if (typeof (topic) !== "string") { throw new Error("invalid topic"); // @TODO: May happen for anonymous events } const fragment = this.interface.getEvent(topic); return this._normalizeRunningEvent(new FragmentRunningEvent(this.address, this.interface, fragment, eventName.topics)); } catch (error) { } // Filter by the unknown topichash const filter = { address: this.address, topics: eventName.topics }; return this._normalizeRunningEvent(new RunningEvent(getEventTag(filter), filter)); } return this._normalizeRunningEvent(new WildcardRunningEvent(this.address, this.interface)); } _checkRunningEvents(runningEvent) { if (runningEvent.listenerCount() === 0) { delete this._runningEvents[runningEvent.tag]; // If we have a poller for this, remove it const emit = this._wrappedEmits[runningEvent.tag]; if (emit && runningEvent.filter) { this.provider.off(runningEvent.filter, emit); delete this._wrappedEmits[runningEvent.tag]; } } } // Subclasses can override this to gracefully recover // from parse errors if they wish _wrapEvent(runningEvent, log, listener) { const event = (0,properties_lib_esm.deepCopy)(log); event.removeListener = () => { if (!listener) { return; } runningEvent.removeListener(listener); this._checkRunningEvents(runningEvent); }; event.getBlock = () => { return this.provider.getBlock(log.blockHash); }; event.getTransaction = () => { return this.provider.getTransaction(log.transactionHash); }; event.getTransactionReceipt = () => { return this.provider.getTransactionReceipt(log.transactionHash); }; // This may throw if the topics and data mismatch the signature runningEvent.prepareEvent(event); return event; } _addEventListener(runningEvent, listener, once) { if (!this.provider) { logger.throwError("events require a provider or a signer with a provider", logger_lib_esm.Logger.errors.UNSUPPORTED_OPERATION, { operation: "once" }); } runningEvent.addListener(listener, once); // Track this running event and its listeners (may already be there; but no hard in updating) this._runningEvents[runningEvent.tag] = runningEvent; // If we are not polling the provider, start polling if (!this._wrappedEmits[runningEvent.tag]) { const wrappedEmit = (log) => { let event = this._wrapEvent(runningEvent, log, listener); // Try to emit the result for the parameterized event... if (event.decodeError == null) { try { const args = runningEvent.getEmit(event); this.emit(runningEvent.filter, ...args); } catch (error) { event.decodeError = error.error; } } // Always emit "event" for fragment-base events if (runningEvent.filter != null) { this.emit("event", event); } // Emit "error" if there was an error if (event.decodeError != null) { this.emit("error", event.decodeError, event); } }; this._wrappedEmits[runningEvent.tag] = wrappedEmit; // Special events, like "error" do not have a filter if (runningEvent.filter != null) { this.provider.on(runningEvent.filter, wrappedEmit); } } } queryFilter(event, fromBlockOrBlockhash, toBlock) { const runningEvent = this._getRunningEvent(event); const filter = (0,properties_lib_esm.shallowCopy)(runningEvent.filter); if (typeof (fromBlockOrBlockhash) === "string" && (0,bytes_lib_esm.isHexString)(fromBlockOrBlockhash, 32)) { if (toBlock != null) { logger.throwArgumentError("cannot specify toBlock with blockhash", "toBlock", toBlock); } filter.blockHash = fromBlockOrBlockhash; } else { filter.fromBlock = ((fromBlockOrBlockhash != null) ? fromBlockOrBlockhash : 0); filter.toBlock = ((toBlock != null) ? toBlock : "latest"); } return this.provider.getLogs(filter).then((logs) => { return logs.map((log) => this._wrapEvent(runningEvent, log, null)); }); } on(event, listener) { this._addEventListener(this._getRunningEvent(event), listener, false); return this; } once(event, listener) { this._addEventListener(this._getRunningEvent(event), listener, true); return this; } emit(eventName, ...args) { if (!this.provider) { return false; } const runningEvent = this._getRunningEvent(eventName); const result = (runningEvent.run(args) > 0); // May have drained all the "once" events; check for living events this._checkRunningEvents(runningEvent); return result; } listenerCount(eventName) { if (!this.provider) { return 0; } if (eventName == null) { return Object.keys(this._runningEvents).reduce((accum, key) => { return accum + this._runningEvents[key].listenerCount(); }, 0); } return this._getRunningEvent(eventName).listenerCount(); } listeners(eventName) { if (!this.provider) { return []; } if (eventName == null) { const result = []; for (let tag in this._runningEvents) { this._runningEvents[tag].listeners().forEach((listener) => { result.push(listener); }); } return result; } return this._getRunningEvent(eventName).listeners(); } removeAllListeners(eventName) { if (!this.provider) { return this; } if (eventName == null) { for (const tag in this._runningEvents) { const runningEvent = this._runningEvents[tag]; runningEvent.removeAllListeners(); this._checkRunningEvents(runningEvent); } return this; } // Delete any listeners const runningEvent = this._getRunningEvent(eventName); runningEvent.removeAllListeners(); this._checkRunningEvents(runningEvent); return this; } off(eventName, listener) { if (!this.provider) { return this; } const runningEvent = this._getRunningEvent(eventName); runningEvent.removeListener(listener); this._checkRunningEvents(runningEvent); return this; } removeListener(eventName, listener) { return this.off(eventName, listener); } } class Contract extends BaseContract { } class ContractFactory { constructor(contractInterface, bytecode, signer) { let bytecodeHex = null; if (typeof (bytecode) === "string") { bytecodeHex = bytecode; } else if ((0,bytes_lib_esm.isBytes)(bytecode)) { bytecodeHex = (0,bytes_lib_esm.hexlify)(bytecode); } else if (bytecode && typeof (bytecode.object) === "string") { // Allow the bytecode object from the Solidity compiler bytecodeHex = bytecode.object; } else { // Crash in the next verification step bytecodeHex = "!"; } // Make sure it is 0x prefixed if (bytecodeHex.substring(0, 2) !== "0x") { bytecodeHex = "0x" + bytecodeHex; } // Make sure the final result is valid bytecode if (!(0,bytes_lib_esm.isHexString)(bytecodeHex) || (bytecodeHex.length % 2)) { logger.throwArgumentError("invalid bytecode", "bytecode", bytecode); } // If we have a signer, make sure it is valid if (signer && !abstract_signer_lib_esm.Signer.isSigner(signer)) { logger.throwArgumentError("invalid signer", "signer", signer); } (0,properties_lib_esm.defineReadOnly)(this, "bytecode", bytecodeHex); (0,properties_lib_esm.defineReadOnly)(this, "interface", (0,properties_lib_esm.getStatic)(new.target, "getInterface")(contractInterface)); (0,properties_lib_esm.defineReadOnly)(this, "signer", signer || null); } // @TODO: Future; rename to populateTransaction? getDeployTransaction(...args) { let tx = {}; // If we have 1 additional argument, we allow transaction overrides if (args.length === this.interface.deploy.inputs.length + 1 && typeof (args[args.length - 1]) === "object") { tx = (0,properties_lib_esm.shallowCopy)(args.pop()); for (const key in tx) { if (!allowedTransactionKeys[key]) { throw new Error("unknown transaction override " + key); } } } // Do not allow these to be overridden in a deployment transaction ["data", "from", "to"].forEach((key) => { if (tx[key] == null) { return; } logger.throwError("cannot override " + key, logger_lib_esm.Logger.errors.UNSUPPORTED_OPERATION, { operation: key }); }); if (tx.value) { const value = bignumber/* BigNumber.from */.O$.from(tx.value); if (!value.isZero() && !this.interface.deploy.payable) { logger.throwError("non-payable constructor cannot override value", logger_lib_esm.Logger.errors.UNSUPPORTED_OPERATION, { operation: "overrides.value", value: tx.value }); } } // Make sure the call matches the constructor signature logger.checkArgumentCount(args.length, this.interface.deploy.inputs.length, " in Contract constructor"); // Set the data to the bytecode + the encoded constructor arguments tx.data = (0,bytes_lib_esm.hexlify)((0,bytes_lib_esm.concat)([ this.bytecode, this.interface.encodeDeploy(args) ])); return tx; } deploy(...args) { return __awaiter(this, void 0, void 0, function* () { let overrides = {}; // If 1 extra parameter was passed in, it contains overrides if (args.length === this.interface.deploy.inputs.length + 1) { overrides = args.pop(); } // Make sure the call matches the constructor signature logger.checkArgumentCount(args.length, this.interface.deploy.inputs.length, " in Contract constructor"); // Resolve ENS names and promises in the arguments const params = yield resolveAddresses(this.signer, args, this.interface.deploy.inputs); params.push(overrides); // Get the deployment transaction (with optional overrides) const unsignedTx = this.getDeployTransaction(...params); // Send the deployment transaction const tx = yield this.signer.sendTransaction(unsignedTx); const address = (0,properties_lib_esm.getStatic)(this.constructor, "getContractAddress")(tx); const contract = (0,properties_lib_esm.getStatic)(this.constructor, "getContract")(address, this.interface, this.signer); // Add the modified wait that wraps events addContractWait(contract, tx); (0,properties_lib_esm.defineReadOnly)(contract, "deployTransaction", tx); return contract; }); } attach(address) { return (this.constructor).getContract(address, this.interface, this.signer); } connect(signer) { return new (this.constructor)(this.interface, this.bytecode, signer); } static fromSolidity(compilerOutput, signer) { if (compilerOutput == null) { logger.throwError("missing compiler output", logger_lib_esm.Logger.errors.MISSING_ARGUMENT, { argument: "compilerOutput" }); } if (typeof (compilerOutput) === "string") { compilerOutput = JSON.parse(compilerOutput); } const abi = compilerOutput.abi; let bytecode = null; if (compilerOutput.bytecode) { bytecode = compilerOutput.bytecode; } else if (compilerOutput.evm && compilerOutput.evm.bytecode) { bytecode = compilerOutput.evm.bytecode; } return new this(abi, bytecode, signer); } static getInterface(contractInterface) { return Contract.getInterface(contractInterface); } static getContractAddress(tx) { return (0,address_lib_esm.getContractAddress)(tx); } static getContract(address, contractInterface, signer) { return new Contract(address, contractInterface, signer); } } //# sourceMappingURL=index.js.map /***/ }), /***/ 35644: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "i": function() { return /* binding */ version; } /* harmony export */ }); const version = "hash/5.6.1"; //# sourceMappingURL=_version.js.map /***/ }), /***/ 32046: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "id": function() { return /* binding */ id; } /* harmony export */ }); /* harmony import */ var _ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(38197); /* harmony import */ var _ethersproject_strings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(29251); function id(text) { return (0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_0__.keccak256)((0,_ethersproject_strings__WEBPACK_IMPORTED_MODULE_1__/* .toUtf8Bytes */ .Y0)(text)); } //# sourceMappingURL=id.js.map /***/ }), /***/ 75931: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "_TypedDataEncoder": function() { return /* reexport safe */ _typed_data__WEBPACK_IMPORTED_MODULE_3__.E; }, /* harmony export */ "dnsEncode": function() { return /* reexport safe */ _namehash__WEBPACK_IMPORTED_MODULE_1__.Kn; }, /* harmony export */ "hashMessage": function() { return /* reexport safe */ _message__WEBPACK_IMPORTED_MODULE_2__.r; }, /* harmony export */ "id": function() { return /* reexport safe */ _id__WEBPACK_IMPORTED_MODULE_0__.id; }, /* harmony export */ "isValidName": function() { return /* reexport safe */ _namehash__WEBPACK_IMPORTED_MODULE_1__.r1; }, /* harmony export */ "messagePrefix": function() { return /* reexport safe */ _message__WEBPACK_IMPORTED_MODULE_2__.B; }, /* harmony export */ "namehash": function() { return /* reexport safe */ _namehash__WEBPACK_IMPORTED_MODULE_1__.VM; } /* harmony export */ }); /* harmony import */ var _id__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(32046); /* harmony import */ var _namehash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84706); /* harmony import */ var _message__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(93684); /* harmony import */ var _typed_data__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(67827); //# sourceMappingURL=index.js.map /***/ }), /***/ 93684: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "B": function() { return /* binding */ messagePrefix; }, /* harmony export */ "r": function() { return /* binding */ hashMessage; } /* harmony export */ }); /* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(16441); /* harmony import */ var _ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(38197); /* harmony import */ var _ethersproject_strings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(29251); const messagePrefix = "\x19Ethereum Signed Message:\n"; function hashMessage(message) { if (typeof (message) === "string") { message = (0,_ethersproject_strings__WEBPACK_IMPORTED_MODULE_0__/* .toUtf8Bytes */ .Y0)(message); } return (0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_1__.keccak256)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.concat)([ (0,_ethersproject_strings__WEBPACK_IMPORTED_MODULE_0__/* .toUtf8Bytes */ .Y0)(messagePrefix), (0,_ethersproject_strings__WEBPACK_IMPORTED_MODULE_0__/* .toUtf8Bytes */ .Y0)(String(message.length)), message ])); } //# sourceMappingURL=message.js.map /***/ }), /***/ 84706: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Kn": function() { return /* binding */ dnsEncode; }, /* harmony export */ "VM": function() { return /* binding */ namehash; }, /* harmony export */ "r1": function() { return /* binding */ isValidName; } /* harmony export */ }); /* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(16441); /* harmony import */ var _ethersproject_strings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(35637); /* harmony import */ var _ethersproject_strings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(29251); /* harmony import */ var _ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(38197); /* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1581); /* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(35644); const logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__/* .version */ .i); const Zeros = new Uint8Array(32); Zeros.fill(0); const Partition = new RegExp("^((.*)\\.)?([^.]+)$"); function isValidName(name) { try { const comps = name.split("."); for (let i = 0; i < comps.length; i++) { if ((0,_ethersproject_strings__WEBPACK_IMPORTED_MODULE_2__/* .nameprep */ .Ll)(comps[i]).length === 0) { throw new Error("empty"); } } return true; } catch (error) { } return false; } function namehash(name) { /* istanbul ignore if */ if (typeof (name) !== "string") { logger.throwArgumentError("invalid ENS name; not a string", "name", name); } let current = name; let result = Zeros; while (current.length) { const partition = current.match(Partition); if (partition == null || partition[2] === "") { logger.throwArgumentError("invalid ENS address; missing component", "name", name); } const label = (0,_ethersproject_strings__WEBPACK_IMPORTED_MODULE_3__/* .toUtf8Bytes */ .Y0)((0,_ethersproject_strings__WEBPACK_IMPORTED_MODULE_2__/* .nameprep */ .Ll)(partition[3])); result = (0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_4__.keccak256)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_5__.concat)([result, (0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_4__.keccak256)(label)])); current = partition[2] || ""; } return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_5__.hexlify)(result); } function dnsEncode(name) { return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_5__.hexlify)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_5__.concat)(name.split(".").map((comp) => { // We jam in an _ prefix to fill in with the length later // Note: Nameprep throws if the component is over 63 bytes const bytes = (0,_ethersproject_strings__WEBPACK_IMPORTED_MODULE_3__/* .toUtf8Bytes */ .Y0)("_" + (0,_ethersproject_strings__WEBPACK_IMPORTED_MODULE_2__/* .nameprep */ .Ll)(comp)); bytes[0] = bytes.length - 1; return bytes; }))) + "00"; } //# sourceMappingURL=namehash.js.map /***/ }), /***/ 67827: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "E": function() { return /* binding */ TypedDataEncoder; } /* harmony export */ }); /* harmony import */ var _ethersproject_address__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(19485); /* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2593); /* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(16441); /* harmony import */ var _ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(38197); /* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(6881); /* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1581); /* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(35644); /* harmony import */ var _id__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(32046); var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; const logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__/* .version */ .i); const padding = new Uint8Array(32); padding.fill(0); const NegativeOne = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_2__/* .BigNumber.from */ .O$.from(-1); const Zero = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_2__/* .BigNumber.from */ .O$.from(0); const One = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_2__/* .BigNumber.from */ .O$.from(1); const MaxUint256 = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_2__/* .BigNumber.from */ .O$.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); function hexPadRight(value) { const bytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.arrayify)(value); const padOffset = bytes.length % 32; if (padOffset) { return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexConcat)([bytes, padding.slice(padOffset)]); } return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexlify)(bytes); } const hexTrue = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexZeroPad)(One.toHexString(), 32); const hexFalse = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexZeroPad)(Zero.toHexString(), 32); const domainFieldTypes = { name: "string", version: "string", chainId: "uint256", verifyingContract: "address", salt: "bytes32" }; const domainFieldNames = [ "name", "version", "chainId", "verifyingContract", "salt" ]; function checkString(key) { return function (value) { if (typeof (value) !== "string") { logger.throwArgumentError(`invalid domain value for ${JSON.stringify(key)}`, `domain.${key}`, value); } return value; }; } const domainChecks = { name: checkString("name"), version: checkString("version"), chainId: function (value) { try { return _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_2__/* .BigNumber.from */ .O$.from(value).toString(); } catch (error) { } return logger.throwArgumentError(`invalid domain value for "chainId"`, "domain.chainId", value); }, verifyingContract: function (value) { try { return (0,_ethersproject_address__WEBPACK_IMPORTED_MODULE_4__.getAddress)(value).toLowerCase(); } catch (error) { } return logger.throwArgumentError(`invalid domain value "verifyingContract"`, "domain.verifyingContract", value); }, salt: function (value) { try { const bytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.arrayify)(value); if (bytes.length !== 32) { throw new Error("bad length"); } return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexlify)(bytes); } catch (error) { } return logger.throwArgumentError(`invalid domain value "salt"`, "domain.salt", value); } }; function getBaseEncoder(type) { // intXX and uintXX { const match = type.match(/^(u?)int(\d*)$/); if (match) { const signed = (match[1] === ""); const width = parseInt(match[2] || "256"); if (width % 8 !== 0 || width > 256 || (match[2] && match[2] !== String(width))) { logger.throwArgumentError("invalid numeric width", "type", type); } const boundsUpper = MaxUint256.mask(signed ? (width - 1) : width); const boundsLower = signed ? boundsUpper.add(One).mul(NegativeOne) : Zero; return function (value) { const v = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_2__/* .BigNumber.from */ .O$.from(value); if (v.lt(boundsLower) || v.gt(boundsUpper)) { logger.throwArgumentError(`value out-of-bounds for ${type}`, "value", value); } return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexZeroPad)(v.toTwos(256).toHexString(), 32); }; } } // bytesXX { const match = type.match(/^bytes(\d+)$/); if (match) { const width = parseInt(match[1]); if (width === 0 || width > 32 || match[1] !== String(width)) { logger.throwArgumentError("invalid bytes width", "type", type); } return function (value) { const bytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.arrayify)(value); if (bytes.length !== width) { logger.throwArgumentError(`invalid length for ${type}`, "value", value); } return hexPadRight(value); }; } } switch (type) { case "address": return function (value) { return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexZeroPad)((0,_ethersproject_address__WEBPACK_IMPORTED_MODULE_4__.getAddress)(value), 32); }; case "bool": return function (value) { return ((!value) ? hexFalse : hexTrue); }; case "bytes": return function (value) { return (0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_5__.keccak256)(value); }; case "string": return function (value) { return (0,_id__WEBPACK_IMPORTED_MODULE_6__.id)(value); }; } return null; } function encodeType(name, fields) { return `${name}(${fields.map(({ name, type }) => (type + " " + name)).join(",")})`; } class TypedDataEncoder { constructor(types) { (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__.defineReadOnly)(this, "types", Object.freeze((0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__.deepCopy)(types))); (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__.defineReadOnly)(this, "_encoderCache", {}); (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__.defineReadOnly)(this, "_types", {}); // Link struct types to their direct child structs const links = {}; // Link structs to structs which contain them as a child const parents = {}; // Link all subtypes within a given struct const subtypes = {}; Object.keys(types).forEach((type) => { links[type] = {}; parents[type] = []; subtypes[type] = {}; }); for (const name in types) { const uniqueNames = {}; types[name].forEach((field) => { // Check each field has a unique name if (uniqueNames[field.name]) { logger.throwArgumentError(`duplicate variable name ${JSON.stringify(field.name)} in ${JSON.stringify(name)}`, "types", types); } uniqueNames[field.name] = true; // Get the base type (drop any array specifiers) const baseType = field.type.match(/^([^\x5b]*)(\x5b|$)/)[1]; if (baseType === name) { logger.throwArgumentError(`circular type reference to ${JSON.stringify(baseType)}`, "types", types); } // Is this a base encoding type? const encoder = getBaseEncoder(baseType); if (encoder) { return; } if (!parents[baseType]) { logger.throwArgumentError(`unknown type ${JSON.stringify(baseType)}`, "types", types); } // Add linkage parents[baseType].push(name); links[name][baseType] = true; }); } // Deduce the primary type const primaryTypes = Object.keys(parents).filter((n) => (parents[n].length === 0)); if (primaryTypes.length === 0) { logger.throwArgumentError("missing primary type", "types", types); } else if (primaryTypes.length > 1) { logger.throwArgumentError(`ambiguous primary types or unused types: ${primaryTypes.map((t) => (JSON.stringify(t))).join(", ")}`, "types", types); } (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__.defineReadOnly)(this, "primaryType", primaryTypes[0]); // Check for circular type references function checkCircular(type, found) { if (found[type]) { logger.throwArgumentError(`circular type reference to ${JSON.stringify(type)}`, "types", types); } found[type] = true; Object.keys(links[type]).forEach((child) => { if (!parents[child]) { return; } // Recursively check children checkCircular(child, found); // Mark all ancestors as having this decendant Object.keys(found).forEach((subtype) => { subtypes[subtype][child] = true; }); }); delete found[type]; } checkCircular(this.primaryType, {}); // Compute each fully describe type for (const name in subtypes) { const st = Object.keys(subtypes[name]); st.sort(); this._types[name] = encodeType(name, types[name]) + st.map((t) => encodeType(t, types[t])).join(""); } } getEncoder(type) { let encoder = this._encoderCache[type]; if (!encoder) { encoder = this._encoderCache[type] = this._getEncoder(type); } return encoder; } _getEncoder(type) { // Basic encoder type (address, bool, uint256, etc) { const encoder = getBaseEncoder(type); if (encoder) { return encoder; } } // Array const match = type.match(/^(.*)(\x5b(\d*)\x5d)$/); if (match) { const subtype = match[1]; const subEncoder = this.getEncoder(subtype); const length = parseInt(match[3]); return (value) => { if (length >= 0 && value.length !== length) { logger.throwArgumentError("array length mismatch; expected length ${ arrayLength }", "value", value); } let result = value.map(subEncoder); if (this._types[subtype]) { result = result.map(_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_5__.keccak256); } return (0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_5__.keccak256)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexConcat)(result)); }; } // Struct const fields = this.types[type]; if (fields) { const encodedType = (0,_id__WEBPACK_IMPORTED_MODULE_6__.id)(this._types[type]); return (value) => { const values = fields.map(({ name, type }) => { const result = this.getEncoder(type)(value[name]); if (this._types[type]) { return (0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_5__.keccak256)(result); } return result; }); values.unshift(encodedType); return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexConcat)(values); }; } return logger.throwArgumentError(`unknown type: ${type}`, "type", type); } encodeType(name) { const result = this._types[name]; if (!result) { logger.throwArgumentError(`unknown type: ${JSON.stringify(name)}`, "name", name); } return result; } encodeData(type, value) { return this.getEncoder(type)(value); } hashStruct(name, value) { return (0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_5__.keccak256)(this.encodeData(name, value)); } encode(value) { return this.encodeData(this.primaryType, value); } hash(value) { return this.hashStruct(this.primaryType, value); } _visit(type, value, callback) { // Basic encoder type (address, bool, uint256, etc) { const encoder = getBaseEncoder(type); if (encoder) { return callback(type, value); } } // Array const match = type.match(/^(.*)(\x5b(\d*)\x5d)$/); if (match) { const subtype = match[1]; const length = parseInt(match[3]); if (length >= 0 && value.length !== length) { logger.throwArgumentError("array length mismatch; expected length ${ arrayLength }", "value", value); } return value.map((v) => this._visit(subtype, v, callback)); } // Struct const fields = this.types[type]; if (fields) { return fields.reduce((accum, { name, type }) => { accum[name] = this._visit(type, value[name], callback); return accum; }, {}); } return logger.throwArgumentError(`unknown type: ${type}`, "type", type); } visit(value, callback) { return this._visit(this.primaryType, value, callback); } static from(types) { return new TypedDataEncoder(types); } static getPrimaryType(types) { return TypedDataEncoder.from(types).primaryType; } static hashStruct(name, types, value) { return TypedDataEncoder.from(types).hashStruct(name, value); } static hashDomain(domain) { const domainFields = []; for (const name in domain) { const type = domainFieldTypes[name]; if (!type) { logger.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(name)}`, "domain", domain); } domainFields.push({ name, type }); } domainFields.sort((a, b) => { return domainFieldNames.indexOf(a.name) - domainFieldNames.indexOf(b.name); }); return TypedDataEncoder.hashStruct("EIP712Domain", { EIP712Domain: domainFields }, domain); } static encode(domain, types, value) { return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexConcat)([ "0x1901", TypedDataEncoder.hashDomain(domain), TypedDataEncoder.from(types).hash(value) ]); } static hash(domain, types, value) { return (0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_5__.keccak256)(TypedDataEncoder.encode(domain, types, value)); } // Replaces all address types with ENS names with their looked up address static resolveNames(domain, types, value, resolveName) { return __awaiter(this, void 0, void 0, function* () { // Make a copy to isolate it from the object passed in domain = (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__.shallowCopy)(domain); // Look up all ENS names const ensCache = {}; // Do we need to look up the domain's verifyingContract? if (domain.verifyingContract && !(0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isHexString)(domain.verifyingContract, 20)) { ensCache[domain.verifyingContract] = "0x"; } // We are going to use the encoder to visit all the base values const encoder = TypedDataEncoder.from(types); // Get a list of all the addresses encoder.visit(value, (type, value) => { if (type === "address" && !(0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isHexString)(value, 20)) { ensCache[value] = "0x"; } return value; }); // Lookup each name for (const name in ensCache) { ensCache[name] = yield resolveName(name); } // Replace the domain verifyingContract if needed if (domain.verifyingContract && ensCache[domain.verifyingContract]) { domain.verifyingContract = ensCache[domain.verifyingContract]; } // Replace all ENS names with their address value = encoder.visit(value, (type, value) => { if (type === "address" && ensCache[value]) { return ensCache[value]; } return value; }); return { domain, value }; }); } static getPayload(domain, types, value) { // Validate the domain fields TypedDataEncoder.hashDomain(domain); // Derive the EIP712Domain Struct reference type const domainValues = {}; const domainTypes = []; domainFieldNames.forEach((name) => { const value = domain[name]; if (value == null) { return; } domainValues[name] = domainChecks[name](value); domainTypes.push({ name, type: domainFieldTypes[name] }); }); const encoder = TypedDataEncoder.from(types); const typesWithDomain = (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__.shallowCopy)(types); if (typesWithDomain.EIP712Domain) { logger.throwArgumentError("types must not contain EIP712Domain type", "types.EIP712Domain", types); } else { typesWithDomain.EIP712Domain = domainTypes; } // Validate the data structures and types encoder.encode(value); return { types: typesWithDomain, domain: domainValues, primaryType: encoder.primaryType, message: encoder.visit(value, (type, value) => { // bytes if (type.match(/^bytes(\d*)/)) { return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexlify)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.arrayify)(value)); } // uint or int if (type.match(/^u?int/)) { return _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_2__/* .BigNumber.from */ .O$.from(value).toString(); } switch (type) { case "address": return value.toLowerCase(); case "bool": return !!value; case "string": if (typeof (value) !== "string") { logger.throwArgumentError(`invalid string`, "value", value); } return value; } return logger.throwArgumentError("unsupported type", "type", type); }) }; } } //# sourceMappingURL=typed-data.js.map /***/ }), /***/ 84178: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { "HDNode": function() { return /* binding */ HDNode; }, "defaultPath": function() { return /* binding */ defaultPath; }, "entropyToMnemonic": function() { return /* binding */ entropyToMnemonic; }, "getAccountPath": function() { return /* binding */ getAccountPath; }, "isValidMnemonic": function() { return /* binding */ isValidMnemonic; }, "mnemonicToEntropy": function() { return /* binding */ mnemonicToEntropy; }, "mnemonicToSeed": function() { return /* binding */ mnemonicToSeed; } }); // EXTERNAL MODULE: ./node_modules/@ethersproject/basex/lib.esm/index.js var lib_esm = __webpack_require__(57727); // EXTERNAL MODULE: ./node_modules/@ethersproject/bytes/lib.esm/index.js + 1 modules var bytes_lib_esm = __webpack_require__(16441); // EXTERNAL MODULE: ./node_modules/@ethersproject/bignumber/lib.esm/bignumber.js var bignumber = __webpack_require__(2593); // EXTERNAL MODULE: ./node_modules/@ethersproject/strings/lib.esm/utf8.js + 1 modules var utf8 = __webpack_require__(29251); // EXTERNAL MODULE: ./node_modules/@ethersproject/pbkdf2/lib.esm/pbkdf2.js var pbkdf2 = __webpack_require__(85306); // EXTERNAL MODULE: ./node_modules/@ethersproject/properties/lib.esm/index.js + 1 modules var properties_lib_esm = __webpack_require__(6881); // EXTERNAL MODULE: ./node_modules/@ethersproject/signing-key/lib.esm/index.js + 2 modules var signing_key_lib_esm = __webpack_require__(67669); // EXTERNAL MODULE: ./node_modules/@ethersproject/sha2/lib.esm/sha2.js + 1 modules var sha2 = __webpack_require__(2006); // EXTERNAL MODULE: ./node_modules/@ethersproject/sha2/lib.esm/types.js var types = __webpack_require__(21261); // EXTERNAL MODULE: ./node_modules/@ethersproject/transactions/lib.esm/index.js + 1 modules var transactions_lib_esm = __webpack_require__(83875); // EXTERNAL MODULE: ./node_modules/@ethersproject/wordlists/lib.esm/wordlists.js + 1 modules var wordlists = __webpack_require__(10234); // EXTERNAL MODULE: ./node_modules/@ethersproject/logger/lib.esm/index.js + 1 modules var logger_lib_esm = __webpack_require__(1581); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/hdnode/lib.esm/_version.js const version = "hdnode/5.6.2"; //# sourceMappingURL=_version.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/hdnode/lib.esm/index.js const logger = new logger_lib_esm.Logger(version); const N = bignumber/* BigNumber.from */.O$.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); // "Bitcoin seed" const MasterSecret = (0,utf8/* toUtf8Bytes */.Y0)("Bitcoin seed"); const HardenedBit = 0x80000000; // Returns a byte with the MSB bits set function getUpperMask(bits) { return ((1 << bits) - 1) << (8 - bits); } // Returns a byte with the LSB bits set function getLowerMask(bits) { return (1 << bits) - 1; } function bytes32(value) { return (0,bytes_lib_esm.hexZeroPad)((0,bytes_lib_esm.hexlify)(value), 32); } function base58check(data) { return lib_esm.Base58.encode((0,bytes_lib_esm.concat)([data, (0,bytes_lib_esm.hexDataSlice)((0,sha2/* sha256 */.JQ)((0,sha2/* sha256 */.JQ)(data)), 0, 4)])); } function getWordlist(wordlist) { if (wordlist == null) { return wordlists/* wordlists.en */.E.en; } if (typeof (wordlist) === "string") { const words = wordlists/* wordlists */.E[wordlist]; if (words == null) { logger.throwArgumentError("unknown locale", "wordlist", wordlist); } return words; } return wordlist; } const _constructorGuard = {}; const defaultPath = "m/44'/60'/0'/0/0"; ; class HDNode { /** * This constructor should not be called directly. * * Please use: * - fromMnemonic * - fromSeed */ constructor(constructorGuard, privateKey, publicKey, parentFingerprint, chainCode, index, depth, mnemonicOrPath) { /* istanbul ignore if */ if (constructorGuard !== _constructorGuard) { throw new Error("HDNode constructor cannot be called directly"); } if (privateKey) { const signingKey = new signing_key_lib_esm.SigningKey(privateKey); (0,properties_lib_esm.defineReadOnly)(this, "privateKey", signingKey.privateKey); (0,properties_lib_esm.defineReadOnly)(this, "publicKey", signingKey.compressedPublicKey); } else { (0,properties_lib_esm.defineReadOnly)(this, "privateKey", null); (0,properties_lib_esm.defineReadOnly)(this, "publicKey", (0,bytes_lib_esm.hexlify)(publicKey)); } (0,properties_lib_esm.defineReadOnly)(this, "parentFingerprint", parentFingerprint); (0,properties_lib_esm.defineReadOnly)(this, "fingerprint", (0,bytes_lib_esm.hexDataSlice)((0,sha2/* ripemd160 */.bP)((0,sha2/* sha256 */.JQ)(this.publicKey)), 0, 4)); (0,properties_lib_esm.defineReadOnly)(this, "address", (0,transactions_lib_esm.computeAddress)(this.publicKey)); (0,properties_lib_esm.defineReadOnly)(this, "chainCode", chainCode); (0,properties_lib_esm.defineReadOnly)(this, "index", index); (0,properties_lib_esm.defineReadOnly)(this, "depth", depth); if (mnemonicOrPath == null) { // From a source that does not preserve the path (e.g. extended keys) (0,properties_lib_esm.defineReadOnly)(this, "mnemonic", null); (0,properties_lib_esm.defineReadOnly)(this, "path", null); } else if (typeof (mnemonicOrPath) === "string") { // From a source that does not preserve the mnemonic (e.g. neutered) (0,properties_lib_esm.defineReadOnly)(this, "mnemonic", null); (0,properties_lib_esm.defineReadOnly)(this, "path", mnemonicOrPath); } else { // From a fully qualified source (0,properties_lib_esm.defineReadOnly)(this, "mnemonic", mnemonicOrPath); (0,properties_lib_esm.defineReadOnly)(this, "path", mnemonicOrPath.path); } } get extendedKey() { // We only support the mainnet values for now, but if anyone needs // testnet values, let me know. I believe current sentiment is that // we should always use mainnet, and use BIP-44 to derive the network // - Mainnet: public=0x0488B21E, private=0x0488ADE4 // - Testnet: public=0x043587CF, private=0x04358394 if (this.depth >= 256) { throw new Error("Depth too large!"); } return base58check((0,bytes_lib_esm.concat)([ ((this.privateKey != null) ? "0x0488ADE4" : "0x0488B21E"), (0,bytes_lib_esm.hexlify)(this.depth), this.parentFingerprint, (0,bytes_lib_esm.hexZeroPad)((0,bytes_lib_esm.hexlify)(this.index), 4), this.chainCode, ((this.privateKey != null) ? (0,bytes_lib_esm.concat)(["0x00", this.privateKey]) : this.publicKey), ])); } neuter() { return new HDNode(_constructorGuard, null, this.publicKey, this.parentFingerprint, this.chainCode, this.index, this.depth, this.path); } _derive(index) { if (index > 0xffffffff) { throw new Error("invalid index - " + String(index)); } // Base path let path = this.path; if (path) { path += "/" + (index & ~HardenedBit); } const data = new Uint8Array(37); if (index & HardenedBit) { if (!this.privateKey) { throw new Error("cannot derive child of neutered node"); } // Data = 0x00 || ser_256(k_par) data.set((0,bytes_lib_esm.arrayify)(this.privateKey), 1); // Hardened path if (path) { path += "'"; } } else { // Data = ser_p(point(k_par)) data.set((0,bytes_lib_esm.arrayify)(this.publicKey)); } // Data += ser_32(i) for (let i = 24; i >= 0; i -= 8) { data[33 + (i >> 3)] = ((index >> (24 - i)) & 0xff); } const I = (0,bytes_lib_esm.arrayify)((0,sha2/* computeHmac */.Gy)(types/* SupportedAlgorithm.sha512 */.p.sha512, this.chainCode, data)); const IL = I.slice(0, 32); const IR = I.slice(32); // The private key let ki = null; // The public key let Ki = null; if (this.privateKey) { ki = bytes32(bignumber/* BigNumber.from */.O$.from(IL).add(this.privateKey).mod(N)); } else { const ek = new signing_key_lib_esm.SigningKey((0,bytes_lib_esm.hexlify)(IL)); Ki = ek._addPoint(this.publicKey); } let mnemonicOrPath = path; const srcMnemonic = this.mnemonic; if (srcMnemonic) { mnemonicOrPath = Object.freeze({ phrase: srcMnemonic.phrase, path: path, locale: (srcMnemonic.locale || "en") }); } return new HDNode(_constructorGuard, ki, Ki, this.fingerprint, bytes32(IR), index, this.depth + 1, mnemonicOrPath); } derivePath(path) { const components = path.split("/"); if (components.length === 0 || (components[0] === "m" && this.depth !== 0)) { throw new Error("invalid path - " + path); } if (components[0] === "m") { components.shift(); } let result = this; for (let i = 0; i < components.length; i++) { const component = components[i]; if (component.match(/^[0-9]+'$/)) { const index = parseInt(component.substring(0, component.length - 1)); if (index >= HardenedBit) { throw new Error("invalid path index - " + component); } result = result._derive(HardenedBit + index); } else if (component.match(/^[0-9]+$/)) { const index = parseInt(component); if (index >= HardenedBit) { throw new Error("invalid path index - " + component); } result = result._derive(index); } else { throw new Error("invalid path component - " + component); } } return result; } static _fromSeed(seed, mnemonic) { const seedArray = (0,bytes_lib_esm.arrayify)(seed); if (seedArray.length < 16 || seedArray.length > 64) { throw new Error("invalid seed"); } const I = (0,bytes_lib_esm.arrayify)((0,sha2/* computeHmac */.Gy)(types/* SupportedAlgorithm.sha512 */.p.sha512, MasterSecret, seedArray)); return new HDNode(_constructorGuard, bytes32(I.slice(0, 32)), null, "0x00000000", bytes32(I.slice(32)), 0, 0, mnemonic); } static fromMnemonic(mnemonic, password, wordlist) { // If a locale name was passed in, find the associated wordlist wordlist = getWordlist(wordlist); // Normalize the case and spacing in the mnemonic (throws if the mnemonic is invalid) mnemonic = entropyToMnemonic(mnemonicToEntropy(mnemonic, wordlist), wordlist); return HDNode._fromSeed(mnemonicToSeed(mnemonic, password), { phrase: mnemonic, path: "m", locale: wordlist.locale }); } static fromSeed(seed) { return HDNode._fromSeed(seed, null); } static fromExtendedKey(extendedKey) { const bytes = lib_esm.Base58.decode(extendedKey); if (bytes.length !== 82 || base58check(bytes.slice(0, 78)) !== extendedKey) { logger.throwArgumentError("invalid extended key", "extendedKey", "[REDACTED]"); } const depth = bytes[4]; const parentFingerprint = (0,bytes_lib_esm.hexlify)(bytes.slice(5, 9)); const index = parseInt((0,bytes_lib_esm.hexlify)(bytes.slice(9, 13)).substring(2), 16); const chainCode = (0,bytes_lib_esm.hexlify)(bytes.slice(13, 45)); const key = bytes.slice(45, 78); switch ((0,bytes_lib_esm.hexlify)(bytes.slice(0, 4))) { // Public Key case "0x0488b21e": case "0x043587cf": return new HDNode(_constructorGuard, null, (0,bytes_lib_esm.hexlify)(key), parentFingerprint, chainCode, index, depth, null); // Private Key case "0x0488ade4": case "0x04358394 ": if (key[0] !== 0) { break; } return new HDNode(_constructorGuard, (0,bytes_lib_esm.hexlify)(key.slice(1)), null, parentFingerprint, chainCode, index, depth, null); } return logger.throwArgumentError("invalid extended key", "extendedKey", "[REDACTED]"); } } function mnemonicToSeed(mnemonic, password) { if (!password) { password = ""; } const salt = (0,utf8/* toUtf8Bytes */.Y0)("mnemonic" + password, utf8/* UnicodeNormalizationForm.NFKD */.Uj.NFKD); return (0,pbkdf2/* pbkdf2 */.n)((0,utf8/* toUtf8Bytes */.Y0)(mnemonic, utf8/* UnicodeNormalizationForm.NFKD */.Uj.NFKD), salt, 2048, 64, "sha512"); } function mnemonicToEntropy(mnemonic, wordlist) { wordlist = getWordlist(wordlist); logger.checkNormalize(); const words = wordlist.split(mnemonic); if ((words.length % 3) !== 0) { throw new Error("invalid mnemonic"); } const entropy = (0,bytes_lib_esm.arrayify)(new Uint8Array(Math.ceil(11 * words.length / 8))); let offset = 0; for (let i = 0; i < words.length; i++) { let index = wordlist.getWordIndex(words[i].normalize("NFKD")); if (index === -1) { throw new Error("invalid mnemonic"); } for (let bit = 0; bit < 11; bit++) { if (index & (1 << (10 - bit))) { entropy[offset >> 3] |= (1 << (7 - (offset % 8))); } offset++; } } const entropyBits = 32 * words.length / 3; const checksumBits = words.length / 3; const checksumMask = getUpperMask(checksumBits); const checksum = (0,bytes_lib_esm.arrayify)((0,sha2/* sha256 */.JQ)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask; if (checksum !== (entropy[entropy.length - 1] & checksumMask)) { throw new Error("invalid checksum"); } return (0,bytes_lib_esm.hexlify)(entropy.slice(0, entropyBits / 8)); } function entropyToMnemonic(entropy, wordlist) { wordlist = getWordlist(wordlist); entropy = (0,bytes_lib_esm.arrayify)(entropy); if ((entropy.length % 4) !== 0 || entropy.length < 16 || entropy.length > 32) { throw new Error("invalid entropy"); } const indices = [0]; let remainingBits = 11; for (let i = 0; i < entropy.length; i++) { // Consume the whole byte (with still more to go) if (remainingBits > 8) { indices[indices.length - 1] <<= 8; indices[indices.length - 1] |= entropy[i]; remainingBits -= 8; // This byte will complete an 11-bit index } else { indices[indices.length - 1] <<= remainingBits; indices[indices.length - 1] |= entropy[i] >> (8 - remainingBits); // Start the next word indices.push(entropy[i] & getLowerMask(8 - remainingBits)); remainingBits += 3; } } // Compute the checksum bits const checksumBits = entropy.length / 4; const checksum = (0,bytes_lib_esm.arrayify)((0,sha2/* sha256 */.JQ)(entropy))[0] & getUpperMask(checksumBits); // Shift the checksum into the word indices indices[indices.length - 1] <<= checksumBits; indices[indices.length - 1] |= (checksum >> (8 - checksumBits)); return wordlist.join(indices.map((index) => wordlist.getWord(index))); } function isValidMnemonic(mnemonic, wordlist) { try { mnemonicToEntropy(mnemonic, wordlist); return true; } catch (error) { } return false; } function getAccountPath(index) { if (typeof (index) !== "number" || index < 0 || index >= HardenedBit || index % 1) { logger.throwArgumentError("invalid account index", "index", index); } return `m/44'/60'/${index}'/0/0`; } //# sourceMappingURL=index.js.map /***/ }), /***/ 29816: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "i": function() { return /* binding */ version; } /* harmony export */ }); const version = "json-wallets/5.6.1"; //# sourceMappingURL=_version.js.map /***/ }), /***/ 64341: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { "decryptCrowdsale": function() { return /* reexport */ decrypt; }, "decryptJsonWallet": function() { return /* binding */ decryptJsonWallet; }, "decryptJsonWalletSync": function() { return /* binding */ decryptJsonWalletSync; }, "decryptKeystore": function() { return /* reexport */ keystore/* decrypt */.pe; }, "decryptKeystoreSync": function() { return /* reexport */ keystore/* decryptSync */.hb; }, "encryptKeystore": function() { return /* reexport */ keystore/* encrypt */.HI; }, "getJsonWalletAddress": function() { return /* reexport */ inspect/* getJsonWalletAddress */.Rb; }, "isCrowdsaleWallet": function() { return /* reexport */ inspect/* isCrowdsaleWallet */.LW; }, "isKeystoreWallet": function() { return /* reexport */ inspect/* isKeystoreWallet */.aO; } }); // EXTERNAL MODULE: ./node_modules/aes-js/index.js var aes_js = __webpack_require__(78826); var aes_js_default = /*#__PURE__*/__webpack_require__.n(aes_js); // EXTERNAL MODULE: ./node_modules/@ethersproject/address/lib.esm/index.js + 1 modules var lib_esm = __webpack_require__(19485); // EXTERNAL MODULE: ./node_modules/@ethersproject/bytes/lib.esm/index.js + 1 modules var bytes_lib_esm = __webpack_require__(16441); // EXTERNAL MODULE: ./node_modules/@ethersproject/keccak256/lib.esm/index.js var keccak256_lib_esm = __webpack_require__(38197); // EXTERNAL MODULE: ./node_modules/@ethersproject/pbkdf2/lib.esm/pbkdf2.js var pbkdf2 = __webpack_require__(85306); // EXTERNAL MODULE: ./node_modules/@ethersproject/strings/lib.esm/utf8.js + 1 modules var utf8 = __webpack_require__(29251); // EXTERNAL MODULE: ./node_modules/@ethersproject/properties/lib.esm/index.js + 1 modules var properties_lib_esm = __webpack_require__(6881); // EXTERNAL MODULE: ./node_modules/@ethersproject/logger/lib.esm/index.js + 1 modules var logger_lib_esm = __webpack_require__(1581); // EXTERNAL MODULE: ./node_modules/@ethersproject/json-wallets/lib.esm/_version.js var _version = __webpack_require__(29816); // EXTERNAL MODULE: ./node_modules/@ethersproject/json-wallets/lib.esm/utils.js var utils = __webpack_require__(97013); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/json-wallets/lib.esm/crowdsale.js const logger = new logger_lib_esm.Logger(_version/* version */.i); class CrowdsaleAccount extends properties_lib_esm.Description { isCrowdsaleAccount(value) { return !!(value && value._isCrowdsaleAccount); } } // See: https://github.com/ethereum/pyethsaletool function decrypt(json, password) { const data = JSON.parse(json); password = (0,utils/* getPassword */.Ij)(password); // Ethereum Address const ethaddr = (0,lib_esm.getAddress)((0,utils/* searchPath */.gx)(data, "ethaddr")); // Encrypted Seed const encseed = (0,utils/* looseArrayify */.p3)((0,utils/* searchPath */.gx)(data, "encseed")); if (!encseed || (encseed.length % 16) !== 0) { logger.throwArgumentError("invalid encseed", "json", json); } const key = (0,bytes_lib_esm.arrayify)((0,pbkdf2/* pbkdf2 */.n)(password, password, 2000, 32, "sha256")).slice(0, 16); const iv = encseed.slice(0, 16); const encryptedSeed = encseed.slice(16); // Decrypt the seed const aesCbc = new (aes_js_default()).ModeOfOperation.cbc(key, iv); const seed = aes_js_default().padding.pkcs7.strip((0,bytes_lib_esm.arrayify)(aesCbc.decrypt(encryptedSeed))); // This wallet format is weird... Convert the binary encoded hex to a string. let seedHex = ""; for (let i = 0; i < seed.length; i++) { seedHex += String.fromCharCode(seed[i]); } const seedHexBytes = (0,utf8/* toUtf8Bytes */.Y0)(seedHex); const privateKey = (0,keccak256_lib_esm.keccak256)(seedHexBytes); return new CrowdsaleAccount({ _isCrowdsaleAccount: true, address: ethaddr, privateKey: privateKey }); } //# sourceMappingURL=crowdsale.js.map // EXTERNAL MODULE: ./node_modules/@ethersproject/json-wallets/lib.esm/inspect.js var inspect = __webpack_require__(67949); // EXTERNAL MODULE: ./node_modules/@ethersproject/json-wallets/lib.esm/keystore.js var keystore = __webpack_require__(81964); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/json-wallets/lib.esm/index.js function decryptJsonWallet(json, password, progressCallback) { if ((0,inspect/* isCrowdsaleWallet */.LW)(json)) { if (progressCallback) { progressCallback(0); } const account = decrypt(json, password); if (progressCallback) { progressCallback(1); } return Promise.resolve(account); } if ((0,inspect/* isKeystoreWallet */.aO)(json)) { return (0,keystore/* decrypt */.pe)(json, password, progressCallback); } return Promise.reject(new Error("invalid JSON wallet")); } function decryptJsonWalletSync(json, password) { if ((0,inspect/* isCrowdsaleWallet */.LW)(json)) { return decrypt(json, password); } if ((0,inspect/* isKeystoreWallet */.aO)(json)) { return (0,keystore/* decryptSync */.hb)(json, password); } throw new Error("invalid JSON wallet"); } //# sourceMappingURL=index.js.map /***/ }), /***/ 67949: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "LW": function() { return /* binding */ isCrowdsaleWallet; }, /* harmony export */ "Rb": function() { return /* binding */ getJsonWalletAddress; }, /* harmony export */ "aO": function() { return /* binding */ isKeystoreWallet; } /* harmony export */ }); /* harmony import */ var _ethersproject_address__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(19485); function isCrowdsaleWallet(json) { let data = null; try { data = JSON.parse(json); } catch (error) { return false; } return (data.encseed && data.ethaddr); } function isKeystoreWallet(json) { let data = null; try { data = JSON.parse(json); } catch (error) { return false; } if (!data.version || parseInt(data.version) !== data.version || parseInt(data.version) !== 3) { return false; } // @TODO: Put more checks to make sure it has kdf, iv and all that good stuff return true; } //export function isJsonWallet(json: string): boolean { // return (isSecretStorageWallet(json) || isCrowdsaleWallet(json)); //} function getJsonWalletAddress(json) { if (isCrowdsaleWallet(json)) { try { return (0,_ethersproject_address__WEBPACK_IMPORTED_MODULE_0__.getAddress)(JSON.parse(json).ethaddr); } catch (error) { return null; } } if (isKeystoreWallet(json)) { try { return (0,_ethersproject_address__WEBPACK_IMPORTED_MODULE_0__.getAddress)(JSON.parse(json).address); } catch (error) { return null; } } return null; } //# sourceMappingURL=inspect.js.map /***/ }), /***/ 81964: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "HI": function() { return /* binding */ encrypt; }, /* harmony export */ "hb": function() { return /* binding */ decryptSync; }, /* harmony export */ "pe": function() { return /* binding */ decrypt; } /* harmony export */ }); /* unused harmony export KeystoreAccount */ /* harmony import */ var aes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(78826); /* harmony import */ var aes_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(aes_js__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var scrypt_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(17635); /* harmony import */ var scrypt_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(scrypt_js__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _ethersproject_address__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(19485); /* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(16441); /* harmony import */ var _ethersproject_hdnode__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(84178); /* harmony import */ var _ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(38197); /* harmony import */ var _ethersproject_pbkdf2__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(85306); /* harmony import */ var _ethersproject_random__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(5634); /* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6881); /* harmony import */ var _ethersproject_transactions__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(83875); /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(97013); /* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1581); /* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(29816); var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; const logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_2__.Logger(_version__WEBPACK_IMPORTED_MODULE_3__/* .version */ .i); // Exported Types function hasMnemonic(value) { return (value != null && value.mnemonic && value.mnemonic.phrase); } class KeystoreAccount extends _ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__.Description { isKeystoreAccount(value) { return !!(value && value._isKeystoreAccount); } } function _decrypt(data, key, ciphertext) { const cipher = (0,_utils__WEBPACK_IMPORTED_MODULE_5__/* .searchPath */ .gx)(data, "crypto/cipher"); if (cipher === "aes-128-ctr") { const iv = (0,_utils__WEBPACK_IMPORTED_MODULE_5__/* .looseArrayify */ .p3)((0,_utils__WEBPACK_IMPORTED_MODULE_5__/* .searchPath */ .gx)(data, "crypto/cipherparams/iv")); const counter = new (aes_js__WEBPACK_IMPORTED_MODULE_0___default().Counter)(iv); const aesCtr = new (aes_js__WEBPACK_IMPORTED_MODULE_0___default().ModeOfOperation.ctr)(key, counter); return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)(aesCtr.decrypt(ciphertext)); } return null; } function _getAccount(data, key) { const ciphertext = (0,_utils__WEBPACK_IMPORTED_MODULE_5__/* .looseArrayify */ .p3)((0,_utils__WEBPACK_IMPORTED_MODULE_5__/* .searchPath */ .gx)(data, "crypto/ciphertext")); const computedMAC = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)((0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_7__.keccak256)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.concat)([key.slice(16, 32), ciphertext]))).substring(2); if (computedMAC !== (0,_utils__WEBPACK_IMPORTED_MODULE_5__/* .searchPath */ .gx)(data, "crypto/mac").toLowerCase()) { throw new Error("invalid password"); } const privateKey = _decrypt(data, key.slice(0, 16), ciphertext); if (!privateKey) { logger.throwError("unsupported cipher", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_2__.Logger.errors.UNSUPPORTED_OPERATION, { operation: "decrypt" }); } const mnemonicKey = key.slice(32, 64); const address = (0,_ethersproject_transactions__WEBPACK_IMPORTED_MODULE_8__.computeAddress)(privateKey); if (data.address) { let check = data.address.toLowerCase(); if (check.substring(0, 2) !== "0x") { check = "0x" + check; } if ((0,_ethersproject_address__WEBPACK_IMPORTED_MODULE_9__.getAddress)(check) !== address) { throw new Error("address mismatch"); } } const account = { _isKeystoreAccount: true, address: address, privateKey: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(privateKey) }; // Version 0.1 x-ethers metadata must contain an encrypted mnemonic phrase if ((0,_utils__WEBPACK_IMPORTED_MODULE_5__/* .searchPath */ .gx)(data, "x-ethers/version") === "0.1") { const mnemonicCiphertext = (0,_utils__WEBPACK_IMPORTED_MODULE_5__/* .looseArrayify */ .p3)((0,_utils__WEBPACK_IMPORTED_MODULE_5__/* .searchPath */ .gx)(data, "x-ethers/mnemonicCiphertext")); const mnemonicIv = (0,_utils__WEBPACK_IMPORTED_MODULE_5__/* .looseArrayify */ .p3)((0,_utils__WEBPACK_IMPORTED_MODULE_5__/* .searchPath */ .gx)(data, "x-ethers/mnemonicCounter")); const mnemonicCounter = new (aes_js__WEBPACK_IMPORTED_MODULE_0___default().Counter)(mnemonicIv); const mnemonicAesCtr = new (aes_js__WEBPACK_IMPORTED_MODULE_0___default().ModeOfOperation.ctr)(mnemonicKey, mnemonicCounter); const path = (0,_utils__WEBPACK_IMPORTED_MODULE_5__/* .searchPath */ .gx)(data, "x-ethers/path") || _ethersproject_hdnode__WEBPACK_IMPORTED_MODULE_10__.defaultPath; const locale = (0,_utils__WEBPACK_IMPORTED_MODULE_5__/* .searchPath */ .gx)(data, "x-ethers/locale") || "en"; const entropy = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)(mnemonicAesCtr.decrypt(mnemonicCiphertext)); try { const mnemonic = (0,_ethersproject_hdnode__WEBPACK_IMPORTED_MODULE_10__.entropyToMnemonic)(entropy, locale); const node = _ethersproject_hdnode__WEBPACK_IMPORTED_MODULE_10__.HDNode.fromMnemonic(mnemonic, null, locale).derivePath(path); if (node.privateKey != account.privateKey) { throw new Error("mnemonic mismatch"); } account.mnemonic = node.mnemonic; } catch (error) { // If we don't have the locale wordlist installed to // read this mnemonic, just bail and don't set the // mnemonic if (error.code !== _ethersproject_logger__WEBPACK_IMPORTED_MODULE_2__.Logger.errors.INVALID_ARGUMENT || error.argument !== "wordlist") { throw error; } } } return new KeystoreAccount(account); } function pbkdf2Sync(passwordBytes, salt, count, dkLen, prfFunc) { return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)((0,_ethersproject_pbkdf2__WEBPACK_IMPORTED_MODULE_11__/* .pbkdf2 */ .n)(passwordBytes, salt, count, dkLen, prfFunc)); } function pbkdf2(passwordBytes, salt, count, dkLen, prfFunc) { return Promise.resolve(pbkdf2Sync(passwordBytes, salt, count, dkLen, prfFunc)); } function _computeKdfKey(data, password, pbkdf2Func, scryptFunc, progressCallback) { const passwordBytes = (0,_utils__WEBPACK_IMPORTED_MODULE_5__/* .getPassword */ .Ij)(password); const kdf = (0,_utils__WEBPACK_IMPORTED_MODULE_5__/* .searchPath */ .gx)(data, "crypto/kdf"); if (kdf && typeof (kdf) === "string") { const throwError = function (name, value) { return logger.throwArgumentError("invalid key-derivation function parameters", name, value); }; if (kdf.toLowerCase() === "scrypt") { const salt = (0,_utils__WEBPACK_IMPORTED_MODULE_5__/* .looseArrayify */ .p3)((0,_utils__WEBPACK_IMPORTED_MODULE_5__/* .searchPath */ .gx)(data, "crypto/kdfparams/salt")); const N = parseInt((0,_utils__WEBPACK_IMPORTED_MODULE_5__/* .searchPath */ .gx)(data, "crypto/kdfparams/n")); const r = parseInt((0,_utils__WEBPACK_IMPORTED_MODULE_5__/* .searchPath */ .gx)(data, "crypto/kdfparams/r")); const p = parseInt((0,_utils__WEBPACK_IMPORTED_MODULE_5__/* .searchPath */ .gx)(data, "crypto/kdfparams/p")); // Check for all required parameters if (!N || !r || !p) { throwError("kdf", kdf); } // Make sure N is a power of 2 if ((N & (N - 1)) !== 0) { throwError("N", N); } const dkLen = parseInt((0,_utils__WEBPACK_IMPORTED_MODULE_5__/* .searchPath */ .gx)(data, "crypto/kdfparams/dklen")); if (dkLen !== 32) { throwError("dklen", dkLen); } return scryptFunc(passwordBytes, salt, N, r, p, 64, progressCallback); } else if (kdf.toLowerCase() === "pbkdf2") { const salt = (0,_utils__WEBPACK_IMPORTED_MODULE_5__/* .looseArrayify */ .p3)((0,_utils__WEBPACK_IMPORTED_MODULE_5__/* .searchPath */ .gx)(data, "crypto/kdfparams/salt")); let prfFunc = null; const prf = (0,_utils__WEBPACK_IMPORTED_MODULE_5__/* .searchPath */ .gx)(data, "crypto/kdfparams/prf"); if (prf === "hmac-sha256") { prfFunc = "sha256"; } else if (prf === "hmac-sha512") { prfFunc = "sha512"; } else { throwError("prf", prf); } const count = parseInt((0,_utils__WEBPACK_IMPORTED_MODULE_5__/* .searchPath */ .gx)(data, "crypto/kdfparams/c")); const dkLen = parseInt((0,_utils__WEBPACK_IMPORTED_MODULE_5__/* .searchPath */ .gx)(data, "crypto/kdfparams/dklen")); if (dkLen !== 32) { throwError("dklen", dkLen); } return pbkdf2Func(passwordBytes, salt, count, dkLen, prfFunc); } } return logger.throwArgumentError("unsupported key-derivation function", "kdf", kdf); } function decryptSync(json, password) { const data = JSON.parse(json); const key = _computeKdfKey(data, password, pbkdf2Sync, (scrypt_js__WEBPACK_IMPORTED_MODULE_1___default().syncScrypt)); return _getAccount(data, key); } function decrypt(json, password, progressCallback) { return __awaiter(this, void 0, void 0, function* () { const data = JSON.parse(json); const key = yield _computeKdfKey(data, password, pbkdf2, (scrypt_js__WEBPACK_IMPORTED_MODULE_1___default().scrypt), progressCallback); return _getAccount(data, key); }); } function encrypt(account, password, options, progressCallback) { try { // Check the address matches the private key if ((0,_ethersproject_address__WEBPACK_IMPORTED_MODULE_9__.getAddress)(account.address) !== (0,_ethersproject_transactions__WEBPACK_IMPORTED_MODULE_8__.computeAddress)(account.privateKey)) { throw new Error("address/privateKey mismatch"); } // Check the mnemonic (if any) matches the private key if (hasMnemonic(account)) { const mnemonic = account.mnemonic; const node = _ethersproject_hdnode__WEBPACK_IMPORTED_MODULE_10__.HDNode.fromMnemonic(mnemonic.phrase, null, mnemonic.locale).derivePath(mnemonic.path || _ethersproject_hdnode__WEBPACK_IMPORTED_MODULE_10__.defaultPath); if (node.privateKey != account.privateKey) { throw new Error("mnemonic mismatch"); } } } catch (e) { return Promise.reject(e); } // The options are optional, so adjust the call as needed if (typeof (options) === "function" && !progressCallback) { progressCallback = options; options = {}; } if (!options) { options = {}; } const privateKey = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)(account.privateKey); const passwordBytes = (0,_utils__WEBPACK_IMPORTED_MODULE_5__/* .getPassword */ .Ij)(password); let entropy = null; let path = null; let locale = null; if (hasMnemonic(account)) { const srcMnemonic = account.mnemonic; entropy = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)((0,_ethersproject_hdnode__WEBPACK_IMPORTED_MODULE_10__.mnemonicToEntropy)(srcMnemonic.phrase, srcMnemonic.locale || "en")); path = srcMnemonic.path || _ethersproject_hdnode__WEBPACK_IMPORTED_MODULE_10__.defaultPath; locale = srcMnemonic.locale || "en"; } let client = options.client; if (!client) { client = "ethers.js"; } // Check/generate the salt let salt = null; if (options.salt) { salt = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)(options.salt); } else { salt = (0,_ethersproject_random__WEBPACK_IMPORTED_MODULE_12__/* .randomBytes */ .O)(32); ; } // Override initialization vector let iv = null; if (options.iv) { iv = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)(options.iv); if (iv.length !== 16) { throw new Error("invalid iv"); } } else { iv = (0,_ethersproject_random__WEBPACK_IMPORTED_MODULE_12__/* .randomBytes */ .O)(16); } // Override the uuid let uuidRandom = null; if (options.uuid) { uuidRandom = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)(options.uuid); if (uuidRandom.length !== 16) { throw new Error("invalid uuid"); } } else { uuidRandom = (0,_ethersproject_random__WEBPACK_IMPORTED_MODULE_12__/* .randomBytes */ .O)(16); } // Override the scrypt password-based key derivation function parameters let N = (1 << 17), r = 8, p = 1; if (options.scrypt) { if (options.scrypt.N) { N = options.scrypt.N; } if (options.scrypt.r) { r = options.scrypt.r; } if (options.scrypt.p) { p = options.scrypt.p; } } // We take 64 bytes: // - 32 bytes As normal for the Web3 secret storage (derivedKey, macPrefix) // - 32 bytes AES key to encrypt mnemonic with (required here to be Ethers Wallet) return scrypt_js__WEBPACK_IMPORTED_MODULE_1___default().scrypt(passwordBytes, salt, N, r, p, 64, progressCallback).then((key) => { key = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)(key); // This will be used to encrypt the wallet (as per Web3 secret storage) const derivedKey = key.slice(0, 16); const macPrefix = key.slice(16, 32); // This will be used to encrypt the mnemonic phrase (if any) const mnemonicKey = key.slice(32, 64); // Encrypt the private key const counter = new (aes_js__WEBPACK_IMPORTED_MODULE_0___default().Counter)(iv); const aesCtr = new (aes_js__WEBPACK_IMPORTED_MODULE_0___default().ModeOfOperation.ctr)(derivedKey, counter); const ciphertext = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)(aesCtr.encrypt(privateKey)); // Compute the message authentication code, used to check the password const mac = (0,_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_7__.keccak256)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.concat)([macPrefix, ciphertext])); // See: https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition const data = { address: account.address.substring(2).toLowerCase(), id: (0,_utils__WEBPACK_IMPORTED_MODULE_5__/* .uuidV4 */ .EH)(uuidRandom), version: 3, Crypto: { cipher: "aes-128-ctr", cipherparams: { iv: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(iv).substring(2), }, ciphertext: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(ciphertext).substring(2), kdf: "scrypt", kdfparams: { salt: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(salt).substring(2), n: N, dklen: 32, p: p, r: r }, mac: mac.substring(2) } }; // If we have a mnemonic, encrypt it into the JSON wallet if (entropy) { const mnemonicIv = (0,_ethersproject_random__WEBPACK_IMPORTED_MODULE_12__/* .randomBytes */ .O)(16); const mnemonicCounter = new (aes_js__WEBPACK_IMPORTED_MODULE_0___default().Counter)(mnemonicIv); const mnemonicAesCtr = new (aes_js__WEBPACK_IMPORTED_MODULE_0___default().ModeOfOperation.ctr)(mnemonicKey, mnemonicCounter); const mnemonicCiphertext = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.arrayify)(mnemonicAesCtr.encrypt(entropy)); const now = new Date(); const timestamp = (now.getUTCFullYear() + "-" + (0,_utils__WEBPACK_IMPORTED_MODULE_5__/* .zpad */ .VP)(now.getUTCMonth() + 1, 2) + "-" + (0,_utils__WEBPACK_IMPORTED_MODULE_5__/* .zpad */ .VP)(now.getUTCDate(), 2) + "T" + (0,_utils__WEBPACK_IMPORTED_MODULE_5__/* .zpad */ .VP)(now.getUTCHours(), 2) + "-" + (0,_utils__WEBPACK_IMPORTED_MODULE_5__/* .zpad */ .VP)(now.getUTCMinutes(), 2) + "-" + (0,_utils__WEBPACK_IMPORTED_MODULE_5__/* .zpad */ .VP)(now.getUTCSeconds(), 2) + ".0Z"); data["x-ethers"] = { client: client, gethFilename: ("UTC--" + timestamp + "--" + data.address), mnemonicCounter: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(mnemonicIv).substring(2), mnemonicCiphertext: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_6__.hexlify)(mnemonicCiphertext).substring(2), path: path, locale: locale, version: "0.1" }; } return JSON.stringify(data); }); } //# sourceMappingURL=keystore.js.map /***/ }), /***/ 97013: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "EH": function() { return /* binding */ uuidV4; }, /* harmony export */ "Ij": function() { return /* binding */ getPassword; }, /* harmony export */ "VP": function() { return /* binding */ zpad; }, /* harmony export */ "gx": function() { return /* binding */ searchPath; }, /* harmony export */ "p3": function() { return /* binding */ looseArrayify; } /* harmony export */ }); /* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16441); /* harmony import */ var _ethersproject_strings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(29251); function looseArrayify(hexString) { if (typeof (hexString) === 'string' && hexString.substring(0, 2) !== '0x') { hexString = '0x' + hexString; } return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.arrayify)(hexString); } function zpad(value, length) { value = String(value); while (value.length < length) { value = '0' + value; } return value; } function getPassword(password) { if (typeof (password) === 'string') { return (0,_ethersproject_strings__WEBPACK_IMPORTED_MODULE_1__/* .toUtf8Bytes */ .Y0)(password, _ethersproject_strings__WEBPACK_IMPORTED_MODULE_1__/* .UnicodeNormalizationForm.NFKC */ .Uj.NFKC); } return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.arrayify)(password); } function searchPath(object, path) { let currentChild = object; const comps = path.toLowerCase().split('/'); for (let i = 0; i < comps.length; i++) { // Search for a child object with a case-insensitive matching key let matchingChild = null; for (const key in currentChild) { if (key.toLowerCase() === comps[i]) { matchingChild = currentChild[key]; break; } } // Didn't find one. :'( if (matchingChild === null) { return null; } // Now check this child... currentChild = matchingChild; } return currentChild; } // See: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4) function uuidV4(randomBytes) { const bytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.arrayify)(randomBytes); // Section: 4.1.3: // - time_hi_and_version[12:16] = 0b0100 bytes[6] = (bytes[6] & 0x0f) | 0x40; // Section 4.4 // - clock_seq_hi_and_reserved[6] = 0b0 // - clock_seq_hi_and_reserved[7] = 0b1 bytes[8] = (bytes[8] & 0x3f) | 0x80; const value = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.hexlify)(bytes); return [ value.substring(2, 10), value.substring(10, 14), value.substring(14, 18), value.substring(18, 22), value.substring(22, 34), ].join("-"); } //# sourceMappingURL=utils.js.map /***/ }), /***/ 38197: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "keccak256": function() { return /* binding */ keccak256; } /* harmony export */ }); /* harmony import */ var js_sha3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(91094); /* harmony import */ var js_sha3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(js_sha3__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16441); function keccak256(data) { return '0x' + js_sha3__WEBPACK_IMPORTED_MODULE_0___default().keccak_256((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__.arrayify)(data)); } //# sourceMappingURL=index.js.map /***/ }), /***/ 1581: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { "ErrorCode": function() { return /* binding */ ErrorCode; }, "LogLevel": function() { return /* binding */ LogLevel; }, "Logger": function() { return /* binding */ Logger; } }); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/logger/lib.esm/_version.js const version = "logger/5.6.0"; //# sourceMappingURL=_version.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/logger/lib.esm/index.js let _permanentCensorErrors = false; let _censorErrors = false; const LogLevels = { debug: 1, "default": 2, info: 2, warning: 3, error: 4, off: 5 }; let _logLevel = LogLevels["default"]; let _globalLogger = null; function _checkNormalize() { try { const missing = []; // Make sure all forms of normalization are supported ["NFD", "NFC", "NFKD", "NFKC"].forEach((form) => { try { if ("test".normalize(form) !== "test") { throw new Error("bad normalize"); } ; } catch (error) { missing.push(form); } }); if (missing.length) { throw new Error("missing " + missing.join(", ")); } if (String.fromCharCode(0xe9).normalize("NFD") !== String.fromCharCode(0x65, 0x0301)) { throw new Error("broken implementation"); } } catch (error) { return error.message; } return null; } const _normalizeError = _checkNormalize(); var LogLevel; (function (LogLevel) { LogLevel["DEBUG"] = "DEBUG"; LogLevel["INFO"] = "INFO"; LogLevel["WARNING"] = "WARNING"; LogLevel["ERROR"] = "ERROR"; LogLevel["OFF"] = "OFF"; })(LogLevel || (LogLevel = {})); var ErrorCode; (function (ErrorCode) { /////////////////// // Generic Errors // Unknown Error ErrorCode["UNKNOWN_ERROR"] = "UNKNOWN_ERROR"; // Not Implemented ErrorCode["NOT_IMPLEMENTED"] = "NOT_IMPLEMENTED"; // Unsupported Operation // - operation ErrorCode["UNSUPPORTED_OPERATION"] = "UNSUPPORTED_OPERATION"; // Network Error (i.e. Ethereum Network, such as an invalid chain ID) // - event ("noNetwork" is not re-thrown in provider.ready; otherwise thrown) ErrorCode["NETWORK_ERROR"] = "NETWORK_ERROR"; // Some sort of bad response from the server ErrorCode["SERVER_ERROR"] = "SERVER_ERROR"; // Timeout ErrorCode["TIMEOUT"] = "TIMEOUT"; /////////////////// // Operational Errors // Buffer Overrun ErrorCode["BUFFER_OVERRUN"] = "BUFFER_OVERRUN"; // Numeric Fault // - operation: the operation being executed // - fault: the reason this faulted ErrorCode["NUMERIC_FAULT"] = "NUMERIC_FAULT"; /////////////////// // Argument Errors // Missing new operator to an object // - name: The name of the class ErrorCode["MISSING_NEW"] = "MISSING_NEW"; // Invalid argument (e.g. value is incompatible with type) to a function: // - argument: The argument name that was invalid // - value: The value of the argument ErrorCode["INVALID_ARGUMENT"] = "INVALID_ARGUMENT"; // Missing argument to a function: // - count: The number of arguments received // - expectedCount: The number of arguments expected ErrorCode["MISSING_ARGUMENT"] = "MISSING_ARGUMENT"; // Too many arguments // - count: The number of arguments received // - expectedCount: The number of arguments expected ErrorCode["UNEXPECTED_ARGUMENT"] = "UNEXPECTED_ARGUMENT"; /////////////////// // Blockchain Errors // Call exception // - transaction: the transaction // - address?: the contract address // - args?: The arguments passed into the function // - method?: The Solidity method signature // - errorSignature?: The EIP848 error signature // - errorArgs?: The EIP848 error parameters // - reason: The reason (only for EIP848 "Error(string)") ErrorCode["CALL_EXCEPTION"] = "CALL_EXCEPTION"; // Insufficient funds (< value + gasLimit * gasPrice) // - transaction: the transaction attempted ErrorCode["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS"; // Nonce has already been used // - transaction: the transaction attempted ErrorCode["NONCE_EXPIRED"] = "NONCE_EXPIRED"; // The replacement fee for the transaction is too low // - transaction: the transaction attempted ErrorCode["REPLACEMENT_UNDERPRICED"] = "REPLACEMENT_UNDERPRICED"; // The gas limit could not be estimated // - transaction: the transaction passed to estimateGas ErrorCode["UNPREDICTABLE_GAS_LIMIT"] = "UNPREDICTABLE_GAS_LIMIT"; // The transaction was replaced by one with a higher gas price // - reason: "cancelled", "replaced" or "repriced" // - cancelled: true if reason == "cancelled" or reason == "replaced") // - hash: original transaction hash // - replacement: the full TransactionsResponse for the replacement // - receipt: the receipt of the replacement ErrorCode["TRANSACTION_REPLACED"] = "TRANSACTION_REPLACED"; })(ErrorCode || (ErrorCode = {})); ; const HEX = "0123456789abcdef"; class Logger { constructor(version) { Object.defineProperty(this, "version", { enumerable: true, value: version, writable: false }); } _log(logLevel, args) { const level = logLevel.toLowerCase(); if (LogLevels[level] == null) { this.throwArgumentError("invalid log level name", "logLevel", logLevel); } if (_logLevel > LogLevels[level]) { return; } console.log.apply(console, args); } debug(...args) { this._log(Logger.levels.DEBUG, args); } info(...args) { this._log(Logger.levels.INFO, args); } warn(...args) { this._log(Logger.levels.WARNING, args); } makeError(message, code, params) { // Errors are being censored if (_censorErrors) { return this.makeError("censored error", code, {}); } if (!code) { code = Logger.errors.UNKNOWN_ERROR; } if (!params) { params = {}; } const messageDetails = []; Object.keys(params).forEach((key) => { const value = params[key]; try { if (value instanceof Uint8Array) { let hex = ""; for (let i = 0; i < value.length; i++) { hex += HEX[value[i] >> 4]; hex += HEX[value[i] & 0x0f]; } messageDetails.push(key + "=Uint8Array(0x" + hex + ")"); } else { messageDetails.push(key + "=" + JSON.stringify(value)); } } catch (error) { messageDetails.push(key + "=" + JSON.stringify(params[key].toString())); } }); messageDetails.push(`code=${code}`); messageDetails.push(`version=${this.version}`); const reason = message; let url = ""; switch (code) { case ErrorCode.NUMERIC_FAULT: { url = "NUMERIC_FAULT"; const fault = message; switch (fault) { case "overflow": case "underflow": case "division-by-zero": url += "-" + fault; break; case "negative-power": case "negative-width": url += "-unsupported"; break; case "unbound-bitwise-result": url += "-unbound-result"; break; } break; } case ErrorCode.CALL_EXCEPTION: case ErrorCode.INSUFFICIENT_FUNDS: case ErrorCode.MISSING_NEW: case ErrorCode.NONCE_EXPIRED: case ErrorCode.REPLACEMENT_UNDERPRICED: case ErrorCode.TRANSACTION_REPLACED: case ErrorCode.UNPREDICTABLE_GAS_LIMIT: url = code; break; } if (url) { message += " [ See: https:/\/links.ethers.org/v5-errors-" + url + " ]"; } if (messageDetails.length) { message += " (" + messageDetails.join(", ") + ")"; } // @TODO: Any?? const error = new Error(message); error.reason = reason; error.code = code; Object.keys(params).forEach(function (key) { error[key] = params[key]; }); return error; } throwError(message, code, params) { throw this.makeError(message, code, params); } throwArgumentError(message, name, value) { return this.throwError(message, Logger.errors.INVALID_ARGUMENT, { argument: name, value: value }); } assert(condition, message, code, params) { if (!!condition) { return; } this.throwError(message, code, params); } assertArgument(condition, message, name, value) { if (!!condition) { return; } this.throwArgumentError(message, name, value); } checkNormalize(message) { if (message == null) { message = "platform missing String.prototype.normalize"; } if (_normalizeError) { this.throwError("platform missing String.prototype.normalize", Logger.errors.UNSUPPORTED_OPERATION, { operation: "String.prototype.normalize", form: _normalizeError }); } } checkSafeUint53(value, message) { if (typeof (value) !== "number") { return; } if (message == null) { message = "value not safe"; } if (value < 0 || value >= 0x1fffffffffffff) { this.throwError(message, Logger.errors.NUMERIC_FAULT, { operation: "checkSafeInteger", fault: "out-of-safe-range", value: value }); } if (value % 1) { this.throwError(message, Logger.errors.NUMERIC_FAULT, { operation: "checkSafeInteger", fault: "non-integer", value: value }); } } checkArgumentCount(count, expectedCount, message) { if (message) { message = ": " + message; } else { message = ""; } if (count < expectedCount) { this.throwError("missing argument" + message, Logger.errors.MISSING_ARGUMENT, { count: count, expectedCount: expectedCount }); } if (count > expectedCount) { this.throwError("too many arguments" + message, Logger.errors.UNEXPECTED_ARGUMENT, { count: count, expectedCount: expectedCount }); } } checkNew(target, kind) { if (target === Object || target == null) { this.throwError("missing new", Logger.errors.MISSING_NEW, { name: kind.name }); } } checkAbstract(target, kind) { if (target === kind) { this.throwError("cannot instantiate abstract class " + JSON.stringify(kind.name) + " directly; use a sub-class", Logger.errors.UNSUPPORTED_OPERATION, { name: target.name, operation: "new" }); } else if (target === Object || target == null) { this.throwError("missing new", Logger.errors.MISSING_NEW, { name: kind.name }); } } static globalLogger() { if (!_globalLogger) { _globalLogger = new Logger(version); } return _globalLogger; } static setCensorship(censorship, permanent) { if (!censorship && permanent) { this.globalLogger().throwError("cannot permanently disable censorship", Logger.errors.UNSUPPORTED_OPERATION, { operation: "setCensorship" }); } if (_permanentCensorErrors) { if (!censorship) { return; } this.globalLogger().throwError("error censorship permanent", Logger.errors.UNSUPPORTED_OPERATION, { operation: "setCensorship" }); } _censorErrors = !!censorship; _permanentCensorErrors = !!permanent; } static setLogLevel(logLevel) { const level = LogLevels[logLevel.toLowerCase()]; if (level == null) { Logger.globalLogger().warn("invalid log level - " + logLevel); return; } _logLevel = level; } static from(version) { return new Logger(version); } } Logger.errors = ErrorCode; Logger.levels = LogLevel; //# sourceMappingURL=index.js.map /***/ }), /***/ 45710: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { "H": function() { return /* binding */ getNetwork; } }); // EXTERNAL MODULE: ./node_modules/@ethersproject/logger/lib.esm/index.js + 1 modules var lib_esm = __webpack_require__(1581); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/networks/lib.esm/_version.js const version = "networks/5.6.4"; //# sourceMappingURL=_version.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/networks/lib.esm/index.js const logger = new lib_esm.Logger(version); ; function isRenetworkable(value) { return (value && typeof (value.renetwork) === "function"); } function ethDefaultProvider(network) { const func = function (providers, options) { if (options == null) { options = {}; } const providerList = []; if (providers.InfuraProvider && options.infura !== "-") { try { providerList.push(new providers.InfuraProvider(network, options.infura)); } catch (error) { } } if (providers.EtherscanProvider && options.etherscan !== "-") { try { providerList.push(new providers.EtherscanProvider(network, options.etherscan)); } catch (error) { } } if (providers.AlchemyProvider && options.alchemy !== "-") { try { providerList.push(new providers.AlchemyProvider(network, options.alchemy)); } catch (error) { } } if (providers.PocketProvider && options.pocket !== "-") { // These networks are currently faulty on Pocket as their // network does not handle the Berlin hardfork, which is // live on these ones. // @TODO: This goes away once Pocket has upgraded their nodes const skip = ["goerli", "ropsten", "rinkeby"]; try { const provider = new providers.PocketProvider(network, options.pocket); if (provider.network && skip.indexOf(provider.network.name) === -1) { providerList.push(provider); } } catch (error) { } } if (providers.CloudflareProvider && options.cloudflare !== "-") { try { providerList.push(new providers.CloudflareProvider(network)); } catch (error) { } } if (providers.AnkrProvider && options.ankr !== "-") { try { const skip = ["ropsten"]; const provider = new providers.AnkrProvider(network, options.ankr); if (provider.network && skip.indexOf(provider.network.name) === -1) { providerList.push(provider); } } catch (error) { } } if (providerList.length === 0) { return null; } if (providers.FallbackProvider) { let quorum = 1; if (options.quorum != null) { quorum = options.quorum; } else if (network === "homestead") { quorum = 2; } return new providers.FallbackProvider(providerList, quorum); } return providerList[0]; }; func.renetwork = function (network) { return ethDefaultProvider(network); }; return func; } function etcDefaultProvider(url, network) { const func = function (providers, options) { if (providers.JsonRpcProvider) { return new providers.JsonRpcProvider(url, network); } return null; }; func.renetwork = function (network) { return etcDefaultProvider(url, network); }; return func; } const homestead = { chainId: 1, ensAddress: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", name: "homestead", _defaultProvider: ethDefaultProvider("homestead") }; const ropsten = { chainId: 3, ensAddress: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", name: "ropsten", _defaultProvider: ethDefaultProvider("ropsten") }; const classicMordor = { chainId: 63, name: "classicMordor", _defaultProvider: etcDefaultProvider("https://www.ethercluster.com/mordor", "classicMordor") }; // See: https://chainlist.org const networks = { unspecified: { chainId: 0, name: "unspecified" }, homestead: homestead, mainnet: homestead, morden: { chainId: 2, name: "morden" }, ropsten: ropsten, testnet: ropsten, rinkeby: { chainId: 4, ensAddress: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", name: "rinkeby", _defaultProvider: ethDefaultProvider("rinkeby") }, kovan: { chainId: 42, name: "kovan", _defaultProvider: ethDefaultProvider("kovan") }, goerli: { chainId: 5, ensAddress: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", name: "goerli", _defaultProvider: ethDefaultProvider("goerli") }, kintsugi: { chainId: 1337702, name: "kintsugi" }, // ETC (See: #351) classic: { chainId: 61, name: "classic", _defaultProvider: etcDefaultProvider("https:/\/www.ethercluster.com/etc", "classic") }, classicMorden: { chainId: 62, name: "classicMorden" }, classicMordor: classicMordor, classicTestnet: classicMordor, classicKotti: { chainId: 6, name: "classicKotti", _defaultProvider: etcDefaultProvider("https:/\/www.ethercluster.com/kotti", "classicKotti") }, xdai: { chainId: 100, name: "xdai" }, matic: { chainId: 137, name: "matic", _defaultProvider: ethDefaultProvider("matic") }, maticmum: { chainId: 80001, name: "maticmum" }, optimism: { chainId: 10, name: "optimism", _defaultProvider: ethDefaultProvider("optimism") }, "optimism-kovan": { chainId: 69, name: "optimism-kovan" }, "optimism-goerli": { chainId: 420, name: "optimism-goerli" }, arbitrum: { chainId: 42161, name: "arbitrum" }, "arbitrum-rinkeby": { chainId: 421611, name: "arbitrum-rinkeby" }, bnb: { chainId: 56, name: "bnb" }, bnbt: { chainId: 97, name: "bnbt" }, }; /** * getNetwork * * Converts a named common networks or chain ID (network ID) to a Network * and verifies a network is a valid Network.. */ function getNetwork(network) { // No network (null) if (network == null) { return null; } if (typeof (network) === "number") { for (const name in networks) { const standard = networks[name]; if (standard.chainId === network) { return { name: standard.name, chainId: standard.chainId, ensAddress: (standard.ensAddress || null), _defaultProvider: (standard._defaultProvider || null) }; } } return { chainId: network, name: "unknown" }; } if (typeof (network) === "string") { const standard = networks[network]; if (standard == null) { return null; } return { name: standard.name, chainId: standard.chainId, ensAddress: standard.ensAddress, _defaultProvider: (standard._defaultProvider || null) }; } const standard = networks[network.name]; // Not a standard network; check that it is a valid network in general if (!standard) { if (typeof (network.chainId) !== "number") { logger.throwArgumentError("invalid network chainId", "network", network); } return network; } // Make sure the chainId matches the expected network chainId (or is 0; disable EIP-155) if (network.chainId !== 0 && network.chainId !== standard.chainId) { logger.throwArgumentError("network chainId mismatch", "network", network); } // @TODO: In the next major version add an attach function to a defaultProvider // class and move the _defaultProvider internal to this file (extend Network) let defaultProvider = network._defaultProvider || null; if (defaultProvider == null && standard._defaultProvider) { if (isRenetworkable(standard._defaultProvider)) { defaultProvider = standard._defaultProvider.renetwork(network); } else { defaultProvider = standard._defaultProvider; } } // Standard Network (allow overriding the ENS address) return { name: network.name, chainId: standard.chainId, ensAddress: (network.ensAddress || standard.ensAddress || null), _defaultProvider: defaultProvider }; } //# sourceMappingURL=index.js.map /***/ }), /***/ 85306: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "n": function() { return /* binding */ pbkdf2; } /* harmony export */ }); /* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16441); /* harmony import */ var _ethersproject_sha2__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2006); function pbkdf2(password, salt, iterations, keylen, hashAlgorithm) { password = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.arrayify)(password); salt = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.arrayify)(salt); let hLen; let l = 1; const DK = new Uint8Array(keylen); const block1 = new Uint8Array(salt.length + 4); block1.set(salt); //salt.copy(block1, 0, 0, salt.length) let r; let T; for (let i = 1; i <= l; i++) { //block1.writeUInt32BE(i, salt.length) block1[salt.length] = (i >> 24) & 0xff; block1[salt.length + 1] = (i >> 16) & 0xff; block1[salt.length + 2] = (i >> 8) & 0xff; block1[salt.length + 3] = i & 0xff; //let U = createHmac(password).update(block1).digest(); let U = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.arrayify)((0,_ethersproject_sha2__WEBPACK_IMPORTED_MODULE_1__/* .computeHmac */ .Gy)(hashAlgorithm, password, block1)); if (!hLen) { hLen = U.length; T = new Uint8Array(hLen); l = Math.ceil(keylen / hLen); r = keylen - (l - 1) * hLen; } //U.copy(T, 0, 0, hLen) T.set(U); for (let j = 1; j < iterations; j++) { //U = createHmac(password).update(U).digest(); U = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.arrayify)((0,_ethersproject_sha2__WEBPACK_IMPORTED_MODULE_1__/* .computeHmac */ .Gy)(hashAlgorithm, password, U)); for (let k = 0; k < hLen; k++) T[k] ^= U[k]; } const destPos = (i - 1) * hLen; const len = (i === l ? r : hLen); //T.copy(DK, destPos, 0, len) DK.set((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.arrayify)(T).slice(0, len), destPos); } return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__.hexlify)(DK); } //# sourceMappingURL=pbkdf2.js.map /***/ }), /***/ 6881: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { "Description": function() { return /* binding */ Description; }, "checkProperties": function() { return /* binding */ checkProperties; }, "deepCopy": function() { return /* binding */ deepCopy; }, "defineReadOnly": function() { return /* binding */ defineReadOnly; }, "getStatic": function() { return /* binding */ getStatic; }, "resolveProperties": function() { return /* binding */ resolveProperties; }, "shallowCopy": function() { return /* binding */ shallowCopy; } }); // EXTERNAL MODULE: ./node_modules/@ethersproject/logger/lib.esm/index.js + 1 modules var lib_esm = __webpack_require__(1581); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/properties/lib.esm/_version.js const version = "properties/5.6.0"; //# sourceMappingURL=_version.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/properties/lib.esm/index.js var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; const logger = new lib_esm.Logger(version); function defineReadOnly(object, name, value) { Object.defineProperty(object, name, { enumerable: true, value: value, writable: false, }); } // Crawl up the constructor chain to find a static method function getStatic(ctor, key) { for (let i = 0; i < 32; i++) { if (ctor[key]) { return ctor[key]; } if (!ctor.prototype || typeof (ctor.prototype) !== "object") { break; } ctor = Object.getPrototypeOf(ctor.prototype).constructor; } return null; } function resolveProperties(object) { return __awaiter(this, void 0, void 0, function* () { const promises = Object.keys(object).map((key) => { const value = object[key]; return Promise.resolve(value).then((v) => ({ key: key, value: v })); }); const results = yield Promise.all(promises); return results.reduce((accum, result) => { accum[(result.key)] = result.value; return accum; }, {}); }); } function checkProperties(object, properties) { if (!object || typeof (object) !== "object") { logger.throwArgumentError("invalid object", "object", object); } Object.keys(object).forEach((key) => { if (!properties[key]) { logger.throwArgumentError("invalid object key - " + key, "transaction:" + key, object); } }); } function shallowCopy(object) { const result = {}; for (const key in object) { result[key] = object[key]; } return result; } const opaque = { bigint: true, boolean: true, "function": true, number: true, string: true }; function _isFrozen(object) { // Opaque objects are not mutable, so safe to copy by assignment if (object === undefined || object === null || opaque[typeof (object)]) { return true; } if (Array.isArray(object) || typeof (object) === "object") { if (!Object.isFrozen(object)) { return false; } const keys = Object.keys(object); for (let i = 0; i < keys.length; i++) { let value = null; try { value = object[keys[i]]; } catch (error) { // If accessing a value triggers an error, it is a getter // designed to do so (e.g. Result) and is therefore "frozen" continue; } if (!_isFrozen(value)) { return false; } } return true; } return logger.throwArgumentError(`Cannot deepCopy ${typeof (object)}`, "object", object); } // Returns a new copy of object, such that no properties may be replaced. // New properties may be added only to objects. function _deepCopy(object) { if (_isFrozen(object)) { return object; } // Arrays are mutable, so we need to create a copy if (Array.isArray(object)) { return Object.freeze(object.map((item) => deepCopy(item))); } if (typeof (object) === "object") { const result = {}; for (const key in object) { const value = object[key]; if (value === undefined) { continue; } defineReadOnly(result, key, deepCopy(value)); } return result; } return logger.throwArgumentError(`Cannot deepCopy ${typeof (object)}`, "object", object); } function deepCopy(object) { return _deepCopy(object); } class Description { constructor(info) { for (const key in info) { this[key] = deepCopy(info[key]); } } } //# sourceMappingURL=index.js.map /***/ }), /***/ 34216: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "i": function() { return /* binding */ version; } /* harmony export */ }); const version = "providers/5.6.8"; //# sourceMappingURL=_version.js.map /***/ }), /***/ 75361: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "H2": function() { return /* binding */ Resolver; }, /* harmony export */ "Zk": function() { return /* binding */ BaseProvider; } /* harmony export */ }); /* unused harmony export Event */ /* harmony import */ var _ethersproject_abstract_provider__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(81556); /* harmony import */ var _ethersproject_base64__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(59567); /* harmony import */ var _ethersproject_basex__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(57727); /* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(2593); /* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(16441); /* harmony import */ var _ethersproject_constants__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(57218); /* harmony import */ var _ethersproject_hash__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(84706); /* harmony import */ var _ethersproject_networks__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(45710); /* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6881); /* harmony import */ var _ethersproject_sha2__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(2006); /* harmony import */ var _ethersproject_strings__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(29251); /* harmony import */ var _ethersproject_web__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(37707); /* harmony import */ var bech32__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(92882); /* harmony import */ var bech32__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(bech32__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1581); /* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(34216); /* harmony import */ var _formatter__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(30032); var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; const logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger(_version__WEBPACK_IMPORTED_MODULE_2__/* .version */ .i); const MAX_CCIP_REDIRECTS = 10; ////////////////////////////// // Event Serializeing function checkTopic(topic) { if (topic == null) { return "null"; } if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexDataLength)(topic) !== 32) { logger.throwArgumentError("invalid topic", "topic", topic); } return topic.toLowerCase(); } function serializeTopics(topics) { // Remove trailing null AND-topics; they are redundant topics = topics.slice(); while (topics.length > 0 && topics[topics.length - 1] == null) { topics.pop(); } return topics.map((topic) => { if (Array.isArray(topic)) { // Only track unique OR-topics const unique = {}; topic.forEach((topic) => { unique[checkTopic(topic)] = true; }); // The order of OR-topics does not matter const sorted = Object.keys(unique); sorted.sort(); return sorted.join("|"); } else { return checkTopic(topic); } }).join("&"); } function deserializeTopics(data) { if (data === "") { return []; } return data.split(/&/g).map((topic) => { if (topic === "") { return []; } const comps = topic.split("|").map((topic) => { return ((topic === "null") ? null : topic); }); return ((comps.length === 1) ? comps[0] : comps); }); } function getEventTag(eventName) { if (typeof (eventName) === "string") { eventName = eventName.toLowerCase(); if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexDataLength)(eventName) === 32) { return "tx:" + eventName; } if (eventName.indexOf(":") === -1) { return eventName; } } else if (Array.isArray(eventName)) { return "filter:*:" + serializeTopics(eventName); } else if (_ethersproject_abstract_provider__WEBPACK_IMPORTED_MODULE_4__.ForkEvent.isForkEvent(eventName)) { logger.warn("not implemented"); throw new Error("not implemented"); } else if (eventName && typeof (eventName) === "object") { return "filter:" + (eventName.address || "*") + ":" + serializeTopics(eventName.topics || []); } throw new Error("invalid event - " + eventName); } ////////////////////////////// // Helper Object function getTime() { return (new Date()).getTime(); } function stall(duration) { return new Promise((resolve) => { setTimeout(resolve, duration); }); } ////////////////////////////// // Provider Object /** * EventType * - "block" * - "poll" * - "didPoll" * - "pending" * - "error" * - "network" * - filter * - topics array * - transaction hash */ const PollableEvents = ["block", "network", "pending", "poll"]; class Event { constructor(tag, listener, once) { (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__.defineReadOnly)(this, "tag", tag); (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__.defineReadOnly)(this, "listener", listener); (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__.defineReadOnly)(this, "once", once); this._lastBlockNumber = -2; this._inflight = false; } get event() { switch (this.type) { case "tx": return this.hash; case "filter": return this.filter; } return this.tag; } get type() { return this.tag.split(":")[0]; } get hash() { const comps = this.tag.split(":"); if (comps[0] !== "tx") { return null; } return comps[1]; } get filter() { const comps = this.tag.split(":"); if (comps[0] !== "filter") { return null; } const address = comps[1]; const topics = deserializeTopics(comps[2]); const filter = {}; if (topics.length > 0) { filter.topics = topics; } if (address && address !== "*") { filter.address = address; } return filter; } pollable() { return (this.tag.indexOf(":") >= 0 || PollableEvents.indexOf(this.tag) >= 0); } } ; // https://github.com/satoshilabs/slips/blob/master/slip-0044.md const coinInfos = { "0": { symbol: "btc", p2pkh: 0x00, p2sh: 0x05, prefix: "bc" }, "2": { symbol: "ltc", p2pkh: 0x30, p2sh: 0x32, prefix: "ltc" }, "3": { symbol: "doge", p2pkh: 0x1e, p2sh: 0x16 }, "60": { symbol: "eth", ilk: "eth" }, "61": { symbol: "etc", ilk: "eth" }, "700": { symbol: "xdai", ilk: "eth" }, }; function bytes32ify(value) { return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexZeroPad)(_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_6__/* .BigNumber.from */ .O$.from(value).toHexString(), 32); } // Compute the Base58Check encoded data (checksum is first 4 bytes of sha256d) function base58Encode(data) { return _ethersproject_basex__WEBPACK_IMPORTED_MODULE_7__.Base58.encode((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.concat)([data, (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexDataSlice)((0,_ethersproject_sha2__WEBPACK_IMPORTED_MODULE_8__/* .sha256 */ .JQ)((0,_ethersproject_sha2__WEBPACK_IMPORTED_MODULE_8__/* .sha256 */ .JQ)(data)), 0, 4)])); } const matcherIpfs = new RegExp("^(ipfs):/\/(.*)$", "i"); const matchers = [ new RegExp("^(https):/\/(.*)$", "i"), new RegExp("^(data):(.*)$", "i"), matcherIpfs, new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$", "i"), ]; function _parseString(result, start) { try { return (0,_ethersproject_strings__WEBPACK_IMPORTED_MODULE_9__/* .toUtf8String */ .ZN)(_parseBytes(result, start)); } catch (error) { } return null; } function _parseBytes(result, start) { if (result === "0x") { return null; } const offset = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_6__/* .BigNumber.from */ .O$.from((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexDataSlice)(result, start, start + 32)).toNumber(); const length = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_6__/* .BigNumber.from */ .O$.from((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexDataSlice)(result, offset, offset + 32)).toNumber(); return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexDataSlice)(result, offset + 32, offset + 32 + length); } // Trim off the ipfs:// prefix and return the default gateway URL function getIpfsLink(link) { if (link.match(/^ipfs:\/\/ipfs\//i)) { link = link.substring(12); } else if (link.match(/^ipfs:\/\//i)) { link = link.substring(7); } else { logger.throwArgumentError("unsupported IPFS format", "link", link); } return `https:/\/gateway.ipfs.io/ipfs/${link}`; } function numPad(value) { const result = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.arrayify)(value); if (result.length > 32) { throw new Error("internal; should not happen"); } const padded = new Uint8Array(32); padded.set(result, 32 - result.length); return padded; } function bytesPad(value) { if ((value.length % 32) === 0) { return value; } const result = new Uint8Array(Math.ceil(value.length / 32) * 32); result.set(value); return result; } // ABI Encodes a series of (bytes, bytes, ...) function encodeBytes(datas) { const result = []; let byteCount = 0; // Add place-holders for pointers as we add items for (let i = 0; i < datas.length; i++) { result.push(null); byteCount += 32; } for (let i = 0; i < datas.length; i++) { const data = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.arrayify)(datas[i]); // Update the bytes offset result[i] = numPad(byteCount); // The length and padded value of data result.push(numPad(data.length)); result.push(bytesPad(data)); byteCount += 32 + Math.ceil(data.length / 32) * 32; } return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexConcat)(result); } class Resolver { // The resolvedAddress is only for creating a ReverseLookup resolver constructor(provider, address, name, resolvedAddress) { (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__.defineReadOnly)(this, "provider", provider); (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__.defineReadOnly)(this, "name", name); (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__.defineReadOnly)(this, "address", provider.formatter.address(address)); (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__.defineReadOnly)(this, "_resolvedAddress", resolvedAddress); } supportsWildcard() { if (!this._supportsEip2544) { // supportsInterface(bytes4 = selector("resolve(bytes,bytes)")) this._supportsEip2544 = this.provider.call({ to: this.address, data: "0x01ffc9a79061b92300000000000000000000000000000000000000000000000000000000" }).then((result) => { return _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_6__/* .BigNumber.from */ .O$.from(result).eq(1); }).catch((error) => { if (error.code === _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.CALL_EXCEPTION) { return false; } // Rethrow the error: link is down, etc. Let future attempts retry. this._supportsEip2544 = null; throw error; }); } return this._supportsEip2544; } _fetch(selector, parameters) { return __awaiter(this, void 0, void 0, function* () { // e.g. keccak256("addr(bytes32,uint256)") const tx = { to: this.address, ccipReadEnabled: true, data: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexConcat)([selector, (0,_ethersproject_hash__WEBPACK_IMPORTED_MODULE_10__/* .namehash */ .VM)(this.name), (parameters || "0x")]) }; // Wildcard support; use EIP-2544 to resolve the request let parseBytes = false; if (yield this.supportsWildcard()) { parseBytes = true; // selector("resolve(bytes,bytes)") tx.data = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexConcat)(["0x9061b923", encodeBytes([(0,_ethersproject_hash__WEBPACK_IMPORTED_MODULE_10__/* .dnsEncode */ .Kn)(this.name), tx.data])]); } try { let result = yield this.provider.call(tx); if (((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.arrayify)(result).length % 32) === 4) { logger.throwError("resolver threw error", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.CALL_EXCEPTION, { transaction: tx, data: result }); } if (parseBytes) { result = _parseBytes(result, 0); } return result; } catch (error) { if (error.code === _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.CALL_EXCEPTION) { return null; } throw error; } }); } _fetchBytes(selector, parameters) { return __awaiter(this, void 0, void 0, function* () { const result = yield this._fetch(selector, parameters); if (result != null) { return _parseBytes(result, 0); } return null; }); } _getAddress(coinType, hexBytes) { const coinInfo = coinInfos[String(coinType)]; if (coinInfo == null) { logger.throwError(`unsupported coin type: ${coinType}`, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNSUPPORTED_OPERATION, { operation: `getAddress(${coinType})` }); } if (coinInfo.ilk === "eth") { return this.provider.formatter.address(hexBytes); } const bytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.arrayify)(hexBytes); // P2PKH: OP_DUP OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG if (coinInfo.p2pkh != null) { const p2pkh = hexBytes.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/); if (p2pkh) { const length = parseInt(p2pkh[1], 16); if (p2pkh[2].length === length * 2 && length >= 1 && length <= 75) { return base58Encode((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.concat)([[coinInfo.p2pkh], ("0x" + p2pkh[2])])); } } } // P2SH: OP_HASH160 OP_EQUAL if (coinInfo.p2sh != null) { const p2sh = hexBytes.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/); if (p2sh) { const length = parseInt(p2sh[1], 16); if (p2sh[2].length === length * 2 && length >= 1 && length <= 75) { return base58Encode((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.concat)([[coinInfo.p2sh], ("0x" + p2sh[2])])); } } } // Bech32 if (coinInfo.prefix != null) { const length = bytes[1]; // https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#witness-program let version = bytes[0]; if (version === 0x00) { if (length !== 20 && length !== 32) { version = -1; } } else { version = -1; } if (version >= 0 && bytes.length === 2 + length && length >= 1 && length <= 75) { const words = bech32__WEBPACK_IMPORTED_MODULE_0___default().toWords(bytes.slice(2)); words.unshift(version); return bech32__WEBPACK_IMPORTED_MODULE_0___default().encode(coinInfo.prefix, words); } } return null; } getAddress(coinType) { return __awaiter(this, void 0, void 0, function* () { if (coinType == null) { coinType = 60; } // If Ethereum, use the standard `addr(bytes32)` if (coinType === 60) { try { // keccak256("addr(bytes32)") const result = yield this._fetch("0x3b3b57de"); // No address if (result === "0x" || result === _ethersproject_constants__WEBPACK_IMPORTED_MODULE_11__/* .HashZero */ .R) { return null; } return this.provider.formatter.callAddress(result); } catch (error) { if (error.code === _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.CALL_EXCEPTION) { return null; } throw error; } } // keccak256("addr(bytes32,uint256") const hexBytes = yield this._fetchBytes("0xf1cb7e06", bytes32ify(coinType)); // No address if (hexBytes == null || hexBytes === "0x") { return null; } // Compute the address const address = this._getAddress(coinType, hexBytes); if (address == null) { logger.throwError(`invalid or unsupported coin data`, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNSUPPORTED_OPERATION, { operation: `getAddress(${coinType})`, coinType: coinType, data: hexBytes }); } return address; }); } getAvatar() { return __awaiter(this, void 0, void 0, function* () { const linkage = [{ type: "name", content: this.name }]; try { // test data for ricmoo.eth //const avatar = "eip155:1/erc721:0x265385c7f4132228A0d54EB1A9e7460b91c0cC68/29233"; const avatar = yield this.getText("avatar"); if (avatar == null) { return null; } for (let i = 0; i < matchers.length; i++) { const match = avatar.match(matchers[i]); if (match == null) { continue; } const scheme = match[1].toLowerCase(); switch (scheme) { case "https": linkage.push({ type: "url", content: avatar }); return { linkage, url: avatar }; case "data": linkage.push({ type: "data", content: avatar }); return { linkage, url: avatar }; case "ipfs": linkage.push({ type: "ipfs", content: avatar }); return { linkage, url: getIpfsLink(avatar) }; case "erc721": case "erc1155": { // Depending on the ERC type, use tokenURI(uint256) or url(uint256) const selector = (scheme === "erc721") ? "0xc87b56dd" : "0x0e89341c"; linkage.push({ type: scheme, content: avatar }); // The owner of this name const owner = (this._resolvedAddress || (yield this.getAddress())); const comps = (match[2] || "").split("/"); if (comps.length !== 2) { return null; } const addr = yield this.provider.formatter.address(comps[0]); const tokenId = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexZeroPad)(_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_6__/* .BigNumber.from */ .O$.from(comps[1]).toHexString(), 32); // Check that this account owns the token if (scheme === "erc721") { // ownerOf(uint256 tokenId) const tokenOwner = this.provider.formatter.callAddress(yield this.provider.call({ to: addr, data: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexConcat)(["0x6352211e", tokenId]) })); if (owner !== tokenOwner) { return null; } linkage.push({ type: "owner", content: tokenOwner }); } else if (scheme === "erc1155") { // balanceOf(address owner, uint256 tokenId) const balance = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_6__/* .BigNumber.from */ .O$.from(yield this.provider.call({ to: addr, data: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexConcat)(["0x00fdd58e", (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexZeroPad)(owner, 32), tokenId]) })); if (balance.isZero()) { return null; } linkage.push({ type: "balance", content: balance.toString() }); } // Call the token contract for the metadata URL const tx = { to: this.provider.formatter.address(comps[0]), data: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexConcat)([selector, tokenId]) }; let metadataUrl = _parseString(yield this.provider.call(tx), 0); if (metadataUrl == null) { return null; } linkage.push({ type: "metadata-url-base", content: metadataUrl }); // ERC-1155 allows a generic {id} in the URL if (scheme === "erc1155") { metadataUrl = metadataUrl.replace("{id}", tokenId.substring(2)); linkage.push({ type: "metadata-url-expanded", content: metadataUrl }); } // Transform IPFS metadata links if (metadataUrl.match(/^ipfs:/i)) { metadataUrl = getIpfsLink(metadataUrl); } linkage.push({ type: "metadata-url", content: metadataUrl }); // Get the token metadata const metadata = yield (0,_ethersproject_web__WEBPACK_IMPORTED_MODULE_12__.fetchJson)(metadataUrl); if (!metadata) { return null; } linkage.push({ type: "metadata", content: JSON.stringify(metadata) }); // Pull the image URL out let imageUrl = metadata.image; if (typeof (imageUrl) !== "string") { return null; } if (imageUrl.match(/^(https:\/\/|data:)/i)) { // Allow } else { // Transform IPFS link to gateway const ipfs = imageUrl.match(matcherIpfs); if (ipfs == null) { return null; } linkage.push({ type: "url-ipfs", content: imageUrl }); imageUrl = getIpfsLink(imageUrl); } linkage.push({ type: "url", content: imageUrl }); return { linkage, url: imageUrl }; } } } } catch (error) { } return null; }); } getContentHash() { return __awaiter(this, void 0, void 0, function* () { // keccak256("contenthash()") const hexBytes = yield this._fetchBytes("0xbc1c58d1"); // No contenthash if (hexBytes == null || hexBytes === "0x") { return null; } // IPFS (CID: 1, Type: DAG-PB) const ipfs = hexBytes.match(/^0xe3010170(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/); if (ipfs) { const length = parseInt(ipfs[3], 16); if (ipfs[4].length === length * 2) { return "ipfs:/\/" + _ethersproject_basex__WEBPACK_IMPORTED_MODULE_7__.Base58.encode("0x" + ipfs[1]); } } // IPNS (CID: 1, Type: libp2p-key) const ipns = hexBytes.match(/^0xe5010172(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/); if (ipns) { const length = parseInt(ipns[3], 16); if (ipns[4].length === length * 2) { return "ipns:/\/" + _ethersproject_basex__WEBPACK_IMPORTED_MODULE_7__.Base58.encode("0x" + ipns[1]); } } // Swarm (CID: 1, Type: swarm-manifest; hash/length hard-coded to keccak256/32) const swarm = hexBytes.match(/^0xe40101fa011b20([0-9a-f]*)$/); if (swarm) { if (swarm[1].length === (32 * 2)) { return "bzz:/\/" + swarm[1]; } } const skynet = hexBytes.match(/^0x90b2c605([0-9a-f]*)$/); if (skynet) { if (skynet[1].length === (34 * 2)) { // URL Safe base64; https://datatracker.ietf.org/doc/html/rfc4648#section-5 const urlSafe = { "=": "", "+": "-", "/": "_" }; const hash = (0,_ethersproject_base64__WEBPACK_IMPORTED_MODULE_13__/* .encode */ .c)("0x" + skynet[1]).replace(/[=+\/]/g, (a) => (urlSafe[a])); return "sia:/\/" + hash; } } return logger.throwError(`invalid or unsupported content hash data`, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNSUPPORTED_OPERATION, { operation: "getContentHash()", data: hexBytes }); }); } getText(key) { return __awaiter(this, void 0, void 0, function* () { // The key encoded as parameter to fetchBytes let keyBytes = (0,_ethersproject_strings__WEBPACK_IMPORTED_MODULE_9__/* .toUtf8Bytes */ .Y0)(key); // The nodehash consumes the first slot, so the string pointer targets // offset 64, with the length at offset 64 and data starting at offset 96 keyBytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.concat)([bytes32ify(64), bytes32ify(keyBytes.length), keyBytes]); // Pad to word-size (32 bytes) if ((keyBytes.length % 32) !== 0) { keyBytes = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.concat)([keyBytes, (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexZeroPad)("0x", 32 - (key.length % 32))]); } const hexBytes = yield this._fetchBytes("0x59d1d43c", (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexlify)(keyBytes)); if (hexBytes == null || hexBytes === "0x") { return null; } return (0,_ethersproject_strings__WEBPACK_IMPORTED_MODULE_9__/* .toUtf8String */ .ZN)(hexBytes); }); } } let defaultFormatter = null; let nextPollId = 1; class BaseProvider extends _ethersproject_abstract_provider__WEBPACK_IMPORTED_MODULE_4__.Provider { /** * ready * * A Promise that resolves only once the provider is ready. * * Sub-classes that call the super with a network without a chainId * MUST set this. Standard named networks have a known chainId. * */ constructor(network) { super(); // Events being listened to this._events = []; this._emitted = { block: -2 }; this.disableCcipRead = false; this.formatter = new.target.getFormatter(); // If network is any, this Provider allows the underlying // network to change dynamically, and we auto-detect the // current network (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__.defineReadOnly)(this, "anyNetwork", (network === "any")); if (this.anyNetwork) { network = this.detectNetwork(); } if (network instanceof Promise) { this._networkPromise = network; // Squash any "unhandled promise" errors; that do not need to be handled network.catch((error) => { }); // Trigger initial network setting (async) this._ready().catch((error) => { }); } else { const knownNetwork = (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__.getStatic)(new.target, "getNetwork")(network); if (knownNetwork) { (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__.defineReadOnly)(this, "_network", knownNetwork); this.emit("network", knownNetwork, null); } else { logger.throwArgumentError("invalid network", "network", network); } } this._maxInternalBlockNumber = -1024; this._lastBlockNumber = -2; this._maxFilterBlockRange = 10; this._pollingInterval = 4000; this._fastQueryDate = 0; } _ready() { return __awaiter(this, void 0, void 0, function* () { if (this._network == null) { let network = null; if (this._networkPromise) { try { network = yield this._networkPromise; } catch (error) { } } // Try the Provider's network detection (this MUST throw if it cannot) if (network == null) { network = yield this.detectNetwork(); } // This should never happen; every Provider sub-class should have // suggested a network by here (or have thrown). if (!network) { logger.throwError("no network detected", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNKNOWN_ERROR, {}); } // Possible this call stacked so do not call defineReadOnly again if (this._network == null) { if (this.anyNetwork) { this._network = network; } else { (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__.defineReadOnly)(this, "_network", network); } this.emit("network", network, null); } } return this._network; }); } // This will always return the most recently established network. // For "any", this can change (a "network" event is emitted before // any change is reflected); otherwise this cannot change get ready() { return (0,_ethersproject_web__WEBPACK_IMPORTED_MODULE_12__.poll)(() => { return this._ready().then((network) => { return network; }, (error) => { // If the network isn't running yet, we will wait if (error.code === _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.NETWORK_ERROR && error.event === "noNetwork") { return undefined; } throw error; }); }); } // @TODO: Remove this and just create a singleton formatter static getFormatter() { if (defaultFormatter == null) { defaultFormatter = new _formatter__WEBPACK_IMPORTED_MODULE_14__/* .Formatter */ .Mb(); } return defaultFormatter; } // @TODO: Remove this and just use getNetwork static getNetwork(network) { return (0,_ethersproject_networks__WEBPACK_IMPORTED_MODULE_15__/* .getNetwork */ .H)((network == null) ? "homestead" : network); } ccipReadFetch(tx, calldata, urls) { return __awaiter(this, void 0, void 0, function* () { if (this.disableCcipRead || urls.length === 0) { return null; } const sender = tx.to.toLowerCase(); const data = calldata.toLowerCase(); const errorMessages = []; for (let i = 0; i < urls.length; i++) { const url = urls[i]; // URL expansion const href = url.replace("{sender}", sender).replace("{data}", data); // If no {data} is present, use POST; otherwise GET const json = (url.indexOf("{data}") >= 0) ? null : JSON.stringify({ data, sender }); const result = yield (0,_ethersproject_web__WEBPACK_IMPORTED_MODULE_12__.fetchJson)({ url: href, errorPassThrough: true }, json, (value, response) => { value.status = response.statusCode; return value; }); if (result.data) { return result.data; } const errorMessage = (result.message || "unknown error"); // 4xx indicates the result is not present; stop if (result.status >= 400 && result.status < 500) { return logger.throwError(`response not found during CCIP fetch: ${errorMessage}`, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.SERVER_ERROR, { url, errorMessage }); } // 5xx indicates server issue; try the next url errorMessages.push(errorMessage); } return logger.throwError(`error encountered during CCIP fetch: ${errorMessages.map((m) => JSON.stringify(m)).join(", ")}`, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.SERVER_ERROR, { urls, errorMessages }); }); } // Fetches the blockNumber, but will reuse any result that is less // than maxAge old or has been requested since the last request _getInternalBlockNumber(maxAge) { return __awaiter(this, void 0, void 0, function* () { yield this._ready(); // Allowing stale data up to maxAge old if (maxAge > 0) { // While there are pending internal block requests... while (this._internalBlockNumber) { // ..."remember" which fetch we started with const internalBlockNumber = this._internalBlockNumber; try { // Check the result is not too stale const result = yield internalBlockNumber; if ((getTime() - result.respTime) <= maxAge) { return result.blockNumber; } // Too old; fetch a new value break; } catch (error) { // The fetch rejected; if we are the first to get the // rejection, drop through so we replace it with a new // fetch; all others blocked will then get that fetch // which won't match the one they "remembered" and loop if (this._internalBlockNumber === internalBlockNumber) { break; } } } } const reqTime = getTime(); const checkInternalBlockNumber = (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__.resolveProperties)({ blockNumber: this.perform("getBlockNumber", {}), networkError: this.getNetwork().then((network) => (null), (error) => (error)) }).then(({ blockNumber, networkError }) => { if (networkError) { // Unremember this bad internal block number if (this._internalBlockNumber === checkInternalBlockNumber) { this._internalBlockNumber = null; } throw networkError; } const respTime = getTime(); blockNumber = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_6__/* .BigNumber.from */ .O$.from(blockNumber).toNumber(); if (blockNumber < this._maxInternalBlockNumber) { blockNumber = this._maxInternalBlockNumber; } this._maxInternalBlockNumber = blockNumber; this._setFastBlockNumber(blockNumber); // @TODO: Still need this? return { blockNumber, reqTime, respTime }; }); this._internalBlockNumber = checkInternalBlockNumber; // Swallow unhandled exceptions; if needed they are handled else where checkInternalBlockNumber.catch((error) => { // Don't null the dead (rejected) fetch, if it has already been updated if (this._internalBlockNumber === checkInternalBlockNumber) { this._internalBlockNumber = null; } }); return (yield checkInternalBlockNumber).blockNumber; }); } poll() { return __awaiter(this, void 0, void 0, function* () { const pollId = nextPollId++; // Track all running promises, so we can trigger a post-poll once they are complete const runners = []; let blockNumber = null; try { blockNumber = yield this._getInternalBlockNumber(100 + this.pollingInterval / 2); } catch (error) { this.emit("error", error); return; } this._setFastBlockNumber(blockNumber); // Emit a poll event after we have the latest (fast) block number this.emit("poll", pollId, blockNumber); // If the block has not changed, meh. if (blockNumber === this._lastBlockNumber) { this.emit("didPoll", pollId); return; } // First polling cycle, trigger a "block" events if (this._emitted.block === -2) { this._emitted.block = blockNumber - 1; } if (Math.abs((this._emitted.block) - blockNumber) > 1000) { logger.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${blockNumber})`); this.emit("error", logger.makeError("network block skew detected", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.NETWORK_ERROR, { blockNumber: blockNumber, event: "blockSkew", previousBlockNumber: this._emitted.block })); this.emit("block", blockNumber); } else { // Notify all listener for each block that has passed for (let i = this._emitted.block + 1; i <= blockNumber; i++) { this.emit("block", i); } } // The emitted block was updated, check for obsolete events if (this._emitted.block !== blockNumber) { this._emitted.block = blockNumber; Object.keys(this._emitted).forEach((key) => { // The block event does not expire if (key === "block") { return; } // The block we were at when we emitted this event const eventBlockNumber = this._emitted[key]; // We cannot garbage collect pending transactions or blocks here // They should be garbage collected by the Provider when setting // "pending" events if (eventBlockNumber === "pending") { return; } // Evict any transaction hashes or block hashes over 12 blocks // old, since they should not return null anyways if (blockNumber - eventBlockNumber > 12) { delete this._emitted[key]; } }); } // First polling cycle if (this._lastBlockNumber === -2) { this._lastBlockNumber = blockNumber - 1; } // Find all transaction hashes we are waiting on this._events.forEach((event) => { switch (event.type) { case "tx": { const hash = event.hash; let runner = this.getTransactionReceipt(hash).then((receipt) => { if (!receipt || receipt.blockNumber == null) { return null; } this._emitted["t:" + hash] = receipt.blockNumber; this.emit(hash, receipt); return null; }).catch((error) => { this.emit("error", error); }); runners.push(runner); break; } case "filter": { // We only allow a single getLogs to be in-flight at a time if (!event._inflight) { event._inflight = true; // Filter from the last known event; due to load-balancing // and some nodes returning updated block numbers before // indexing events, a logs result with 0 entries cannot be // trusted and we must retry a range which includes it again const filter = event.filter; filter.fromBlock = event._lastBlockNumber + 1; filter.toBlock = blockNumber; // Prevent fitler ranges from growing too wild if (filter.toBlock - this._maxFilterBlockRange > filter.fromBlock) { filter.fromBlock = filter.toBlock - this._maxFilterBlockRange; } const runner = this.getLogs(filter).then((logs) => { // Allow the next getLogs event._inflight = false; if (logs.length === 0) { return; } logs.forEach((log) => { // Only when we get an event for a given block number // can we trust the events are indexed if (log.blockNumber > event._lastBlockNumber) { event._lastBlockNumber = log.blockNumber; } // Make sure we stall requests to fetch blocks and txs this._emitted["b:" + log.blockHash] = log.blockNumber; this._emitted["t:" + log.transactionHash] = log.blockNumber; this.emit(filter, log); }); }).catch((error) => { this.emit("error", error); // Allow another getLogs (the range was not updated) event._inflight = false; }); runners.push(runner); } break; } } }); this._lastBlockNumber = blockNumber; // Once all events for this loop have been processed, emit "didPoll" Promise.all(runners).then(() => { this.emit("didPoll", pollId); }).catch((error) => { this.emit("error", error); }); return; }); } // Deprecated; do not use this resetEventsBlock(blockNumber) { this._lastBlockNumber = blockNumber - 1; if (this.polling) { this.poll(); } } get network() { return this._network; } // This method should query the network if the underlying network // can change, such as when connected to a JSON-RPC backend detectNetwork() { return __awaiter(this, void 0, void 0, function* () { return logger.throwError("provider does not support network detection", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNSUPPORTED_OPERATION, { operation: "provider.detectNetwork" }); }); } getNetwork() { return __awaiter(this, void 0, void 0, function* () { const network = yield this._ready(); // Make sure we are still connected to the same network; this is // only an external call for backends which can have the underlying // network change spontaneously const currentNetwork = yield this.detectNetwork(); if (network.chainId !== currentNetwork.chainId) { // We are allowing network changes, things can get complex fast; // make sure you know what you are doing if you use "any" if (this.anyNetwork) { this._network = currentNetwork; // Reset all internal block number guards and caches this._lastBlockNumber = -2; this._fastBlockNumber = null; this._fastBlockNumberPromise = null; this._fastQueryDate = 0; this._emitted.block = -2; this._maxInternalBlockNumber = -1024; this._internalBlockNumber = null; // The "network" event MUST happen before this method resolves // so any events have a chance to unregister, so we stall an // additional event loop before returning from /this/ call this.emit("network", currentNetwork, network); yield stall(0); return this._network; } const error = logger.makeError("underlying network changed", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.NETWORK_ERROR, { event: "changed", network: network, detectedNetwork: currentNetwork }); this.emit("error", error); throw error; } return network; }); } get blockNumber() { this._getInternalBlockNumber(100 + this.pollingInterval / 2).then((blockNumber) => { this._setFastBlockNumber(blockNumber); }, (error) => { }); return (this._fastBlockNumber != null) ? this._fastBlockNumber : -1; } get polling() { return (this._poller != null); } set polling(value) { if (value && !this._poller) { this._poller = setInterval(() => { this.poll(); }, this.pollingInterval); if (!this._bootstrapPoll) { this._bootstrapPoll = setTimeout(() => { this.poll(); // We block additional polls until the polling interval // is done, to prevent overwhelming the poll function this._bootstrapPoll = setTimeout(() => { // If polling was disabled, something may require a poke // since starting the bootstrap poll and it was disabled if (!this._poller) { this.poll(); } // Clear out the bootstrap so we can do another this._bootstrapPoll = null; }, this.pollingInterval); }, 0); } } else if (!value && this._poller) { clearInterval(this._poller); this._poller = null; } } get pollingInterval() { return this._pollingInterval; } set pollingInterval(value) { if (typeof (value) !== "number" || value <= 0 || parseInt(String(value)) != value) { throw new Error("invalid polling interval"); } this._pollingInterval = value; if (this._poller) { clearInterval(this._poller); this._poller = setInterval(() => { this.poll(); }, this._pollingInterval); } } _getFastBlockNumber() { const now = getTime(); // Stale block number, request a newer value if ((now - this._fastQueryDate) > 2 * this._pollingInterval) { this._fastQueryDate = now; this._fastBlockNumberPromise = this.getBlockNumber().then((blockNumber) => { if (this._fastBlockNumber == null || blockNumber > this._fastBlockNumber) { this._fastBlockNumber = blockNumber; } return this._fastBlockNumber; }); } return this._fastBlockNumberPromise; } _setFastBlockNumber(blockNumber) { // Older block, maybe a stale request if (this._fastBlockNumber != null && blockNumber < this._fastBlockNumber) { return; } // Update the time we updated the blocknumber this._fastQueryDate = getTime(); // Newer block number, use it if (this._fastBlockNumber == null || blockNumber > this._fastBlockNumber) { this._fastBlockNumber = blockNumber; this._fastBlockNumberPromise = Promise.resolve(blockNumber); } } waitForTransaction(transactionHash, confirmations, timeout) { return __awaiter(this, void 0, void 0, function* () { return this._waitForTransaction(transactionHash, (confirmations == null) ? 1 : confirmations, timeout || 0, null); }); } _waitForTransaction(transactionHash, confirmations, timeout, replaceable) { return __awaiter(this, void 0, void 0, function* () { const receipt = yield this.getTransactionReceipt(transactionHash); // Receipt is already good if ((receipt ? receipt.confirmations : 0) >= confirmations) { return receipt; } // Poll until the receipt is good... return new Promise((resolve, reject) => { const cancelFuncs = []; let done = false; const alreadyDone = function () { if (done) { return true; } done = true; cancelFuncs.forEach((func) => { func(); }); return false; }; const minedHandler = (receipt) => { if (receipt.confirmations < confirmations) { return; } if (alreadyDone()) { return; } resolve(receipt); }; this.on(transactionHash, minedHandler); cancelFuncs.push(() => { this.removeListener(transactionHash, minedHandler); }); if (replaceable) { let lastBlockNumber = replaceable.startBlock; let scannedBlock = null; const replaceHandler = (blockNumber) => __awaiter(this, void 0, void 0, function* () { if (done) { return; } // Wait 1 second; this is only used in the case of a fault, so // we will trade off a little bit of latency for more consistent // results and fewer JSON-RPC calls yield stall(1000); this.getTransactionCount(replaceable.from).then((nonce) => __awaiter(this, void 0, void 0, function* () { if (done) { return; } if (nonce <= replaceable.nonce) { lastBlockNumber = blockNumber; } else { // First check if the transaction was mined { const mined = yield this.getTransaction(transactionHash); if (mined && mined.blockNumber != null) { return; } } // First time scanning. We start a little earlier for some // wiggle room here to handle the eventually consistent nature // of blockchain (e.g. the getTransactionCount was for a // different block) if (scannedBlock == null) { scannedBlock = lastBlockNumber - 3; if (scannedBlock < replaceable.startBlock) { scannedBlock = replaceable.startBlock; } } while (scannedBlock <= blockNumber) { if (done) { return; } const block = yield this.getBlockWithTransactions(scannedBlock); for (let ti = 0; ti < block.transactions.length; ti++) { const tx = block.transactions[ti]; // Successfully mined! if (tx.hash === transactionHash) { return; } // Matches our transaction from and nonce; its a replacement if (tx.from === replaceable.from && tx.nonce === replaceable.nonce) { if (done) { return; } // Get the receipt of the replacement const receipt = yield this.waitForTransaction(tx.hash, confirmations); // Already resolved or rejected (prolly a timeout) if (alreadyDone()) { return; } // The reason we were replaced let reason = "replaced"; if (tx.data === replaceable.data && tx.to === replaceable.to && tx.value.eq(replaceable.value)) { reason = "repriced"; } else if (tx.data === "0x" && tx.from === tx.to && tx.value.isZero()) { reason = "cancelled"; } // Explain why we were replaced reject(logger.makeError("transaction was replaced", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.TRANSACTION_REPLACED, { cancelled: (reason === "replaced" || reason === "cancelled"), reason, replacement: this._wrapTransaction(tx), hash: transactionHash, receipt })); return; } } scannedBlock++; } } if (done) { return; } this.once("block", replaceHandler); }), (error) => { if (done) { return; } this.once("block", replaceHandler); }); }); if (done) { return; } this.once("block", replaceHandler); cancelFuncs.push(() => { this.removeListener("block", replaceHandler); }); } if (typeof (timeout) === "number" && timeout > 0) { const timer = setTimeout(() => { if (alreadyDone()) { return; } reject(logger.makeError("timeout exceeded", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.TIMEOUT, { timeout: timeout })); }, timeout); if (timer.unref) { timer.unref(); } cancelFuncs.push(() => { clearTimeout(timer); }); } }); }); } getBlockNumber() { return __awaiter(this, void 0, void 0, function* () { return this._getInternalBlockNumber(0); }); } getGasPrice() { return __awaiter(this, void 0, void 0, function* () { yield this.getNetwork(); const result = yield this.perform("getGasPrice", {}); try { return _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_6__/* .BigNumber.from */ .O$.from(result); } catch (error) { return logger.throwError("bad result from backend", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.SERVER_ERROR, { method: "getGasPrice", result, error }); } }); } getBalance(addressOrName, blockTag) { return __awaiter(this, void 0, void 0, function* () { yield this.getNetwork(); const params = yield (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__.resolveProperties)({ address: this._getAddress(addressOrName), blockTag: this._getBlockTag(blockTag) }); const result = yield this.perform("getBalance", params); try { return _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_6__/* .BigNumber.from */ .O$.from(result); } catch (error) { return logger.throwError("bad result from backend", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.SERVER_ERROR, { method: "getBalance", params, result, error }); } }); } getTransactionCount(addressOrName, blockTag) { return __awaiter(this, void 0, void 0, function* () { yield this.getNetwork(); const params = yield (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__.resolveProperties)({ address: this._getAddress(addressOrName), blockTag: this._getBlockTag(blockTag) }); const result = yield this.perform("getTransactionCount", params); try { return _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_6__/* .BigNumber.from */ .O$.from(result).toNumber(); } catch (error) { return logger.throwError("bad result from backend", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.SERVER_ERROR, { method: "getTransactionCount", params, result, error }); } }); } getCode(addressOrName, blockTag) { return __awaiter(this, void 0, void 0, function* () { yield this.getNetwork(); const params = yield (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__.resolveProperties)({ address: this._getAddress(addressOrName), blockTag: this._getBlockTag(blockTag) }); const result = yield this.perform("getCode", params); try { return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexlify)(result); } catch (error) { return logger.throwError("bad result from backend", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.SERVER_ERROR, { method: "getCode", params, result, error }); } }); } getStorageAt(addressOrName, position, blockTag) { return __awaiter(this, void 0, void 0, function* () { yield this.getNetwork(); const params = yield (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__.resolveProperties)({ address: this._getAddress(addressOrName), blockTag: this._getBlockTag(blockTag), position: Promise.resolve(position).then((p) => (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexValue)(p)) }); const result = yield this.perform("getStorageAt", params); try { return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexlify)(result); } catch (error) { return logger.throwError("bad result from backend", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.SERVER_ERROR, { method: "getStorageAt", params, result, error }); } }); } // This should be called by any subclass wrapping a TransactionResponse _wrapTransaction(tx, hash, startBlock) { if (hash != null && (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexDataLength)(hash) !== 32) { throw new Error("invalid response - sendTransaction"); } const result = tx; // Check the hash we expect is the same as the hash the server reported if (hash != null && tx.hash !== hash) { logger.throwError("Transaction hash mismatch from Provider.sendTransaction.", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNKNOWN_ERROR, { expectedHash: tx.hash, returnedHash: hash }); } result.wait = (confirms, timeout) => __awaiter(this, void 0, void 0, function* () { if (confirms == null) { confirms = 1; } if (timeout == null) { timeout = 0; } // Get the details to detect replacement let replacement = undefined; if (confirms !== 0 && startBlock != null) { replacement = { data: tx.data, from: tx.from, nonce: tx.nonce, to: tx.to, value: tx.value, startBlock }; } const receipt = yield this._waitForTransaction(tx.hash, confirms, timeout, replacement); if (receipt == null && confirms === 0) { return null; } // No longer pending, allow the polling loop to garbage collect this this._emitted["t:" + tx.hash] = receipt.blockNumber; if (receipt.status === 0) { logger.throwError("transaction failed", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.CALL_EXCEPTION, { transactionHash: tx.hash, transaction: tx, receipt: receipt }); } return receipt; }); return result; } sendTransaction(signedTransaction) { return __awaiter(this, void 0, void 0, function* () { yield this.getNetwork(); const hexTx = yield Promise.resolve(signedTransaction).then(t => (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexlify)(t)); const tx = this.formatter.transaction(signedTransaction); if (tx.confirmations == null) { tx.confirmations = 0; } const blockNumber = yield this._getInternalBlockNumber(100 + 2 * this.pollingInterval); try { const hash = yield this.perform("sendTransaction", { signedTransaction: hexTx }); return this._wrapTransaction(tx, hash, blockNumber); } catch (error) { error.transaction = tx; error.transactionHash = tx.hash; throw error; } }); } _getTransactionRequest(transaction) { return __awaiter(this, void 0, void 0, function* () { const values = yield transaction; const tx = {}; ["from", "to"].forEach((key) => { if (values[key] == null) { return; } tx[key] = Promise.resolve(values[key]).then((v) => (v ? this._getAddress(v) : null)); }); ["gasLimit", "gasPrice", "maxFeePerGas", "maxPriorityFeePerGas", "value"].forEach((key) => { if (values[key] == null) { return; } tx[key] = Promise.resolve(values[key]).then((v) => (v ? _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_6__/* .BigNumber.from */ .O$.from(v) : null)); }); ["type"].forEach((key) => { if (values[key] == null) { return; } tx[key] = Promise.resolve(values[key]).then((v) => ((v != null) ? v : null)); }); if (values.accessList) { tx.accessList = this.formatter.accessList(values.accessList); } ["data"].forEach((key) => { if (values[key] == null) { return; } tx[key] = Promise.resolve(values[key]).then((v) => (v ? (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexlify)(v) : null)); }); return this.formatter.transactionRequest(yield (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__.resolveProperties)(tx)); }); } _getFilter(filter) { return __awaiter(this, void 0, void 0, function* () { filter = yield filter; const result = {}; if (filter.address != null) { result.address = this._getAddress(filter.address); } ["blockHash", "topics"].forEach((key) => { if (filter[key] == null) { return; } result[key] = filter[key]; }); ["fromBlock", "toBlock"].forEach((key) => { if (filter[key] == null) { return; } result[key] = this._getBlockTag(filter[key]); }); return this.formatter.filter(yield (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__.resolveProperties)(result)); }); } _call(transaction, blockTag, attempt) { return __awaiter(this, void 0, void 0, function* () { if (attempt >= MAX_CCIP_REDIRECTS) { logger.throwError("CCIP read exceeded maximum redirections", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.SERVER_ERROR, { redirects: attempt, transaction }); } const txSender = transaction.to; const result = yield this.perform("call", { transaction, blockTag }); // CCIP Read request via OffchainLookup(address,string[],bytes,bytes4,bytes) if (attempt >= 0 && blockTag === "latest" && txSender != null && result.substring(0, 10) === "0x556f1830" && ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexDataLength)(result) % 32 === 4)) { try { const data = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexDataSlice)(result, 4); // Check the sender of the OffchainLookup matches the transaction const sender = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexDataSlice)(data, 0, 32); if (!_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_6__/* .BigNumber.from */ .O$.from(sender).eq(txSender)) { logger.throwError("CCIP Read sender did not match", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.CALL_EXCEPTION, { name: "OffchainLookup", signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", transaction, data: result }); } // Read the URLs from the response const urls = []; const urlsOffset = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_6__/* .BigNumber.from */ .O$.from((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexDataSlice)(data, 32, 64)).toNumber(); const urlsLength = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_6__/* .BigNumber.from */ .O$.from((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexDataSlice)(data, urlsOffset, urlsOffset + 32)).toNumber(); const urlsData = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexDataSlice)(data, urlsOffset + 32); for (let u = 0; u < urlsLength; u++) { const url = _parseString(urlsData, u * 32); if (url == null) { logger.throwError("CCIP Read contained corrupt URL string", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.CALL_EXCEPTION, { name: "OffchainLookup", signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", transaction, data: result }); } urls.push(url); } // Get the CCIP calldata to forward const calldata = _parseBytes(data, 64); // Get the callbackSelector (bytes4) if (!_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_6__/* .BigNumber.from */ .O$.from((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexDataSlice)(data, 100, 128)).isZero()) { logger.throwError("CCIP Read callback selector included junk", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.CALL_EXCEPTION, { name: "OffchainLookup", signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", transaction, data: result }); } const callbackSelector = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexDataSlice)(data, 96, 100); // Get the extra data to send back to the contract as context const extraData = _parseBytes(data, 128); const ccipResult = yield this.ccipReadFetch(transaction, calldata, urls); if (ccipResult == null) { logger.throwError("CCIP Read disabled or provided no URLs", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.CALL_EXCEPTION, { name: "OffchainLookup", signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", transaction, data: result }); } const tx = { to: txSender, data: (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexConcat)([callbackSelector, encodeBytes([ccipResult, extraData])]) }; return this._call(tx, blockTag, attempt + 1); } catch (error) { if (error.code === _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.SERVER_ERROR) { throw error; } } } try { return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.hexlify)(result); } catch (error) { return logger.throwError("bad result from backend", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.SERVER_ERROR, { method: "call", params: { transaction, blockTag }, result, error }); } }); } call(transaction, blockTag) { return __awaiter(this, void 0, void 0, function* () { yield this.getNetwork(); const resolved = yield (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__.resolveProperties)({ transaction: this._getTransactionRequest(transaction), blockTag: this._getBlockTag(blockTag), ccipReadEnabled: Promise.resolve(transaction.ccipReadEnabled) }); return this._call(resolved.transaction, resolved.blockTag, resolved.ccipReadEnabled ? 0 : -1); }); } estimateGas(transaction) { return __awaiter(this, void 0, void 0, function* () { yield this.getNetwork(); const params = yield (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__.resolveProperties)({ transaction: this._getTransactionRequest(transaction) }); const result = yield this.perform("estimateGas", params); try { return _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_6__/* .BigNumber.from */ .O$.from(result); } catch (error) { return logger.throwError("bad result from backend", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.SERVER_ERROR, { method: "estimateGas", params, result, error }); } }); } _getAddress(addressOrName) { return __awaiter(this, void 0, void 0, function* () { addressOrName = yield addressOrName; if (typeof (addressOrName) !== "string") { logger.throwArgumentError("invalid address or ENS name", "name", addressOrName); } const address = yield this.resolveName(addressOrName); if (address == null) { logger.throwError("ENS name not configured", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNSUPPORTED_OPERATION, { operation: `resolveName(${JSON.stringify(addressOrName)})` }); } return address; }); } _getBlock(blockHashOrBlockTag, includeTransactions) { return __awaiter(this, void 0, void 0, function* () { yield this.getNetwork(); blockHashOrBlockTag = yield blockHashOrBlockTag; // If blockTag is a number (not "latest", etc), this is the block number let blockNumber = -128; const params = { includeTransactions: !!includeTransactions }; if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isHexString)(blockHashOrBlockTag, 32)) { params.blockHash = blockHashOrBlockTag; } else { try { params.blockTag = yield this._getBlockTag(blockHashOrBlockTag); if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isHexString)(params.blockTag)) { blockNumber = parseInt(params.blockTag.substring(2), 16); } } catch (error) { logger.throwArgumentError("invalid block hash or block tag", "blockHashOrBlockTag", blockHashOrBlockTag); } } return (0,_ethersproject_web__WEBPACK_IMPORTED_MODULE_12__.poll)(() => __awaiter(this, void 0, void 0, function* () { const block = yield this.perform("getBlock", params); // Block was not found if (block == null) { // For blockhashes, if we didn't say it existed, that blockhash may // not exist. If we did see it though, perhaps from a log, we know // it exists, and this node is just not caught up yet. if (params.blockHash != null) { if (this._emitted["b:" + params.blockHash] == null) { return null; } } // For block tags, if we are asking for a future block, we return null if (params.blockTag != null) { if (blockNumber > this._emitted.block) { return null; } } // Retry on the next block return undefined; } // Add transactions if (includeTransactions) { let blockNumber = null; for (let i = 0; i < block.transactions.length; i++) { const tx = block.transactions[i]; if (tx.blockNumber == null) { tx.confirmations = 0; } else if (tx.confirmations == null) { if (blockNumber == null) { blockNumber = yield this._getInternalBlockNumber(100 + 2 * this.pollingInterval); } // Add the confirmations using the fast block number (pessimistic) let confirmations = (blockNumber - tx.blockNumber) + 1; if (confirmations <= 0) { confirmations = 1; } tx.confirmations = confirmations; } } const blockWithTxs = this.formatter.blockWithTransactions(block); blockWithTxs.transactions = blockWithTxs.transactions.map((tx) => this._wrapTransaction(tx)); return blockWithTxs; } return this.formatter.block(block); }), { oncePoll: this }); }); } getBlock(blockHashOrBlockTag) { return (this._getBlock(blockHashOrBlockTag, false)); } getBlockWithTransactions(blockHashOrBlockTag) { return (this._getBlock(blockHashOrBlockTag, true)); } getTransaction(transactionHash) { return __awaiter(this, void 0, void 0, function* () { yield this.getNetwork(); transactionHash = yield transactionHash; const params = { transactionHash: this.formatter.hash(transactionHash, true) }; return (0,_ethersproject_web__WEBPACK_IMPORTED_MODULE_12__.poll)(() => __awaiter(this, void 0, void 0, function* () { const result = yield this.perform("getTransaction", params); if (result == null) { if (this._emitted["t:" + transactionHash] == null) { return null; } return undefined; } const tx = this.formatter.transactionResponse(result); if (tx.blockNumber == null) { tx.confirmations = 0; } else if (tx.confirmations == null) { const blockNumber = yield this._getInternalBlockNumber(100 + 2 * this.pollingInterval); // Add the confirmations using the fast block number (pessimistic) let confirmations = (blockNumber - tx.blockNumber) + 1; if (confirmations <= 0) { confirmations = 1; } tx.confirmations = confirmations; } return this._wrapTransaction(tx); }), { oncePoll: this }); }); } getTransactionReceipt(transactionHash) { return __awaiter(this, void 0, void 0, function* () { yield this.getNetwork(); transactionHash = yield transactionHash; const params = { transactionHash: this.formatter.hash(transactionHash, true) }; return (0,_ethersproject_web__WEBPACK_IMPORTED_MODULE_12__.poll)(() => __awaiter(this, void 0, void 0, function* () { const result = yield this.perform("getTransactionReceipt", params); if (result == null) { if (this._emitted["t:" + transactionHash] == null) { return null; } return undefined; } // "geth-etc" returns receipts before they are ready if (result.blockHash == null) { return undefined; } const receipt = this.formatter.receipt(result); if (receipt.blockNumber == null) { receipt.confirmations = 0; } else if (receipt.confirmations == null) { const blockNumber = yield this._getInternalBlockNumber(100 + 2 * this.pollingInterval); // Add the confirmations using the fast block number (pessimistic) let confirmations = (blockNumber - receipt.blockNumber) + 1; if (confirmations <= 0) { confirmations = 1; } receipt.confirmations = confirmations; } return receipt; }), { oncePoll: this }); }); } getLogs(filter) { return __awaiter(this, void 0, void 0, function* () { yield this.getNetwork(); const params = yield (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__.resolveProperties)({ filter: this._getFilter(filter) }); const logs = yield this.perform("getLogs", params); logs.forEach((log) => { if (log.removed == null) { log.removed = false; } }); return _formatter__WEBPACK_IMPORTED_MODULE_14__/* .Formatter.arrayOf */ .Mb.arrayOf(this.formatter.filterLog.bind(this.formatter))(logs); }); } getEtherPrice() { return __awaiter(this, void 0, void 0, function* () { yield this.getNetwork(); return this.perform("getEtherPrice", {}); }); } _getBlockTag(blockTag) { return __awaiter(this, void 0, void 0, function* () { blockTag = yield blockTag; if (typeof (blockTag) === "number" && blockTag < 0) { if (blockTag % 1) { logger.throwArgumentError("invalid BlockTag", "blockTag", blockTag); } let blockNumber = yield this._getInternalBlockNumber(100 + 2 * this.pollingInterval); blockNumber += blockTag; if (blockNumber < 0) { blockNumber = 0; } return this.formatter.blockTag(blockNumber); } return this.formatter.blockTag(blockTag); }); } getResolver(name) { return __awaiter(this, void 0, void 0, function* () { let currentName = name; while (true) { if (currentName === "" || currentName === ".") { return null; } // Optimization since the eth node cannot change and does // not have a wildcard resolver if (name !== "eth" && currentName === "eth") { return null; } // Check the current node for a resolver const addr = yield this._getResolver(currentName, "getResolver"); // Found a resolver! if (addr != null) { const resolver = new Resolver(this, addr, name); // Legacy resolver found, using EIP-2544 so it isn't safe to use if (currentName !== name && !(yield resolver.supportsWildcard())) { return null; } return resolver; } // Get the parent node currentName = currentName.split(".").slice(1).join("."); } }); } _getResolver(name, operation) { return __awaiter(this, void 0, void 0, function* () { if (operation == null) { operation = "ENS"; } const network = yield this.getNetwork(); // No ENS... if (!network.ensAddress) { logger.throwError("network does not support ENS", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.UNSUPPORTED_OPERATION, { operation, network: network.name }); } try { // keccak256("resolver(bytes32)") const addrData = yield this.call({ to: network.ensAddress, data: ("0x0178b8bf" + (0,_ethersproject_hash__WEBPACK_IMPORTED_MODULE_10__/* .namehash */ .VM)(name).substring(2)) }); return this.formatter.callAddress(addrData); } catch (error) { // ENS registry cannot throw errors on resolver(bytes32) } return null; }); } resolveName(name) { return __awaiter(this, void 0, void 0, function* () { name = yield name; // If it is already an address, nothing to resolve try { return Promise.resolve(this.formatter.address(name)); } catch (error) { // If is is a hexstring, the address is bad (See #694) if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isHexString)(name)) { throw error; } } if (typeof (name) !== "string") { logger.throwArgumentError("invalid ENS name", "name", name); } // Get the addr from the resolver const resolver = yield this.getResolver(name); if (!resolver) { return null; } return yield resolver.getAddress(); }); } lookupAddress(address) { return __awaiter(this, void 0, void 0, function* () { address = yield address; address = this.formatter.address(address); const node = address.substring(2).toLowerCase() + ".addr.reverse"; const resolverAddr = yield this._getResolver(node, "lookupAddress"); if (resolverAddr == null) { return null; } // keccak("name(bytes32)") const name = _parseString(yield this.call({ to: resolverAddr, data: ("0x691f3431" + (0,_ethersproject_hash__WEBPACK_IMPORTED_MODULE_10__/* .namehash */ .VM)(node).substring(2)) }), 0); const addr = yield this.resolveName(name); if (addr != address) { return null; } return name; }); } getAvatar(nameOrAddress) { return __awaiter(this, void 0, void 0, function* () { let resolver = null; if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__.isHexString)(nameOrAddress)) { // Address; reverse lookup const address = this.formatter.address(nameOrAddress); const node = address.substring(2).toLowerCase() + ".addr.reverse"; const resolverAddress = yield this._getResolver(node, "getAvatar"); if (!resolverAddress) { return null; } // Try resolving the avatar against the addr.reverse resolver resolver = new Resolver(this, resolverAddress, node); try { const avatar = yield resolver.getAvatar(); if (avatar) { return avatar.url; } } catch (error) { if (error.code !== _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.CALL_EXCEPTION) { throw error; } } // Try getting the name and performing forward lookup; allowing wildcards try { // keccak("name(bytes32)") const name = _parseString(yield this.call({ to: resolverAddress, data: ("0x691f3431" + (0,_ethersproject_hash__WEBPACK_IMPORTED_MODULE_10__/* .namehash */ .VM)(node).substring(2)) }), 0); resolver = yield this.getResolver(name); } catch (error) { if (error.code !== _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.CALL_EXCEPTION) { throw error; } return null; } } else { // ENS name; forward lookup with wildcard resolver = yield this.getResolver(nameOrAddress); if (!resolver) { return null; } } const avatar = yield resolver.getAvatar(); if (avatar == null) { return null; } return avatar.url; }); } perform(method, params) { return logger.throwError(method + " not implemented", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__.Logger.errors.NOT_IMPLEMENTED, { operation: method }); } _startEvent(event) { this.polling = (this._events.filter((e) => e.pollable()).length > 0); } _stopEvent(event) { this.polling = (this._events.filter((e) => e.pollable()).length > 0); } _addEventListener(eventName, listener, once) { const event = new Event(getEventTag(eventName), listener, once); this._events.push(event); this._startEvent(event); return this; } on(eventName, listener) { return this._addEventListener(eventName, listener, false); } once(eventName, listener) { return this._addEventListener(eventName, listener, true); } emit(eventName, ...args) { let result = false; let stopped = []; let eventTag = getEventTag(eventName); this._events = this._events.filter((event) => { if (event.tag !== eventTag) { return true; } setTimeout(() => { event.listener.apply(this, args); }, 0); result = true; if (event.once) { stopped.push(event); return false; } return true; }); stopped.forEach((event) => { this._stopEvent(event); }); return result; } listenerCount(eventName) { if (!eventName) { return this._events.length; } let eventTag = getEventTag(eventName); return this._events.filter((event) => { return (event.tag === eventTag); }).length; } listeners(eventName) { if (eventName == null) { return this._events.map((event) => event.listener); } let eventTag = getEventTag(eventName); return this._events .filter((event) => (event.tag === eventTag)) .map((event) => event.listener); } off(eventName, listener) { if (listener == null) { return this.removeAllListeners(eventName); } const stopped = []; let found = false; let eventTag = getEventTag(eventName); this._events = this._events.filter((event) => { if (event.tag !== eventTag || event.listener != listener) { return true; } if (found) { return true; } found = true; stopped.push(event); return false; }); stopped.forEach((event) => { this._stopEvent(event); }); return this; } removeAllListeners(eventName) { let stopped = []; if (eventName == null) { stopped = this._events; this._events = []; } else { const eventTag = getEventTag(eventName); this._events = this._events.filter((event) => { if (event.tag !== eventTag) { return true; } stopped.push(event); return false; }); } stopped.forEach((event) => { this._stopEvent(event); }); return this; } } //# sourceMappingURL=base-provider.js.map /***/ }), /***/ 51619: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "H": function() { return /* binding */ FallbackProvider; } /* harmony export */ }); /* harmony import */ var _ethersproject_abstract_provider__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(81556); /* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2593); /* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(16441); /* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6881); /* harmony import */ var _ethersproject_random__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(52472); /* harmony import */ var _ethersproject_web__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(37707); /* harmony import */ var _base_provider__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(75361); /* harmony import */ var _formatter__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(30032); /* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1581); /* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(34216); var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; const logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__/* .version */ .i); function now() { return (new Date()).getTime(); } // Returns to network as long as all agree, or null if any is null. // Throws an error if any two networks do not match. function checkNetworks(networks) { let result = null; for (let i = 0; i < networks.length; i++) { const network = networks[i]; // Null! We do not know our network; bail. if (network == null) { return null; } if (result) { // Make sure the network matches the previous networks if (!(result.name === network.name && result.chainId === network.chainId && ((result.ensAddress === network.ensAddress) || (result.ensAddress == null && network.ensAddress == null)))) { logger.throwArgumentError("provider mismatch", "networks", networks); } } else { result = network; } } return result; } function median(values, maxDelta) { values = values.slice().sort(); const middle = Math.floor(values.length / 2); // Odd length; take the middle if (values.length % 2) { return values[middle]; } // Even length; take the average of the two middle const a = values[middle - 1], b = values[middle]; if (maxDelta != null && Math.abs(a - b) > maxDelta) { return null; } return (a + b) / 2; } function serialize(value) { if (value === null) { return "null"; } else if (typeof (value) === "number" || typeof (value) === "boolean") { return JSON.stringify(value); } else if (typeof (value) === "string") { return value; } else if (_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_2__/* .BigNumber.isBigNumber */ .O$.isBigNumber(value)) { return value.toString(); } else if (Array.isArray(value)) { return JSON.stringify(value.map((i) => serialize(i))); } else if (typeof (value) === "object") { const keys = Object.keys(value); keys.sort(); return "{" + keys.map((key) => { let v = value[key]; if (typeof (v) === "function") { v = "[function]"; } else { v = serialize(v); } return JSON.stringify(key) + ":" + v; }).join(",") + "}"; } throw new Error("unknown value type: " + typeof (value)); } // Next request ID to use for emitting debug info let nextRid = 1; ; function stall(duration) { let cancel = null; let timer = null; let promise = (new Promise((resolve) => { cancel = function () { if (timer) { clearTimeout(timer); timer = null; } resolve(); }; timer = setTimeout(cancel, duration); })); const wait = (func) => { promise = promise.then(func); return promise; }; function getPromise() { return promise; } return { cancel, getPromise, wait }; } const ForwardErrors = [ _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.CALL_EXCEPTION, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.INSUFFICIENT_FUNDS, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.NONCE_EXPIRED, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.REPLACEMENT_UNDERPRICED, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.UNPREDICTABLE_GAS_LIMIT ]; const ForwardProperties = [ "address", "args", "errorArgs", "errorSignature", "method", "transaction", ]; ; function exposeDebugConfig(config, now) { const result = { weight: config.weight }; Object.defineProperty(result, "provider", { get: () => config.provider }); if (config.start) { result.start = config.start; } if (now) { result.duration = (now - config.start); } if (config.done) { if (config.error) { result.error = config.error; } else { result.result = config.result || null; } } return result; } function normalizedTally(normalize, quorum) { return function (configs) { // Count the votes for each result const tally = {}; configs.forEach((c) => { const value = normalize(c.result); if (!tally[value]) { tally[value] = { count: 0, result: c.result }; } tally[value].count++; }); // Check for a quorum on any given result const keys = Object.keys(tally); for (let i = 0; i < keys.length; i++) { const check = tally[keys[i]]; if (check.count >= quorum) { return check.result; } } // No quroum return undefined; }; } function getProcessFunc(provider, method, params) { let normalize = serialize; switch (method) { case "getBlockNumber": // Return the median value, unless there is (median + 1) is also // present, in which case that is probably true and the median // is going to be stale soon. In the event of a malicious node, // the lie will be true soon enough. return function (configs) { const values = configs.map((c) => c.result); // Get the median block number let blockNumber = median(configs.map((c) => c.result), 2); if (blockNumber == null) { return undefined; } blockNumber = Math.ceil(blockNumber); // If the next block height is present, its prolly safe to use if (values.indexOf(blockNumber + 1) >= 0) { blockNumber++; } // Don't ever roll back the blockNumber if (blockNumber >= provider._highestBlockNumber) { provider._highestBlockNumber = blockNumber; } return provider._highestBlockNumber; }; case "getGasPrice": // Return the middle (round index up) value, similar to median // but do not average even entries and choose the higher. // Malicious actors must compromise 50% of the nodes to lie. return function (configs) { const values = configs.map((c) => c.result); values.sort(); return values[Math.floor(values.length / 2)]; }; case "getEtherPrice": // Returns the median price. Malicious actors must compromise at // least 50% of the nodes to lie (in a meaningful way). return function (configs) { return median(configs.map((c) => c.result)); }; // No additional normalizing required; serialize is enough case "getBalance": case "getTransactionCount": case "getCode": case "getStorageAt": case "call": case "estimateGas": case "getLogs": break; // We drop the confirmations from transactions as it is approximate case "getTransaction": case "getTransactionReceipt": normalize = function (tx) { if (tx == null) { return null; } tx = (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.shallowCopy)(tx); tx.confirmations = -1; return serialize(tx); }; break; // We drop the confirmations from transactions as it is approximate case "getBlock": // We drop the confirmations from transactions as it is approximate if (params.includeTransactions) { normalize = function (block) { if (block == null) { return null; } block = (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.shallowCopy)(block); block.transactions = block.transactions.map((tx) => { tx = (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.shallowCopy)(tx); tx.confirmations = -1; return tx; }); return serialize(block); }; } else { normalize = function (block) { if (block == null) { return null; } return serialize(block); }; } break; default: throw new Error("unknown method: " + method); } // Return the result if and only if the expected quorum is // satisfied and agreed upon for the final result. return normalizedTally(normalize, provider.quorum); } // If we are doing a blockTag query, we need to make sure the backend is // caught up to the FallbackProvider, before sending a request to it. function waitForSync(config, blockNumber) { return __awaiter(this, void 0, void 0, function* () { const provider = (config.provider); if ((provider.blockNumber != null && provider.blockNumber >= blockNumber) || blockNumber === -1) { return provider; } return (0,_ethersproject_web__WEBPACK_IMPORTED_MODULE_4__.poll)(() => { return new Promise((resolve, reject) => { setTimeout(function () { // We are synced if (provider.blockNumber >= blockNumber) { return resolve(provider); } // We're done; just quit if (config.cancelled) { return resolve(null); } // Try again, next block return resolve(undefined); }, 0); }); }, { oncePoll: provider }); }); } function getRunner(config, currentBlockNumber, method, params) { return __awaiter(this, void 0, void 0, function* () { let provider = config.provider; switch (method) { case "getBlockNumber": case "getGasPrice": return provider[method](); case "getEtherPrice": if (provider.getEtherPrice) { return provider.getEtherPrice(); } break; case "getBalance": case "getTransactionCount": case "getCode": if (params.blockTag && (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_5__.isHexString)(params.blockTag)) { provider = yield waitForSync(config, currentBlockNumber); } return provider[method](params.address, params.blockTag || "latest"); case "getStorageAt": if (params.blockTag && (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_5__.isHexString)(params.blockTag)) { provider = yield waitForSync(config, currentBlockNumber); } return provider.getStorageAt(params.address, params.position, params.blockTag || "latest"); case "getBlock": if (params.blockTag && (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_5__.isHexString)(params.blockTag)) { provider = yield waitForSync(config, currentBlockNumber); } return provider[(params.includeTransactions ? "getBlockWithTransactions" : "getBlock")](params.blockTag || params.blockHash); case "call": case "estimateGas": if (params.blockTag && (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_5__.isHexString)(params.blockTag)) { provider = yield waitForSync(config, currentBlockNumber); } return provider[method](params.transaction); case "getTransaction": case "getTransactionReceipt": return provider[method](params.transactionHash); case "getLogs": { let filter = params.filter; if ((filter.fromBlock && (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_5__.isHexString)(filter.fromBlock)) || (filter.toBlock && (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_5__.isHexString)(filter.toBlock))) { provider = yield waitForSync(config, currentBlockNumber); } return provider.getLogs(filter); } } return logger.throwError("unknown method error", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.UNKNOWN_ERROR, { method: method, params: params }); }); } class FallbackProvider extends _base_provider__WEBPACK_IMPORTED_MODULE_6__/* .BaseProvider */ .Zk { constructor(providers, quorum) { if (providers.length === 0) { logger.throwArgumentError("missing providers", "providers", providers); } const providerConfigs = providers.map((configOrProvider, index) => { if (_ethersproject_abstract_provider__WEBPACK_IMPORTED_MODULE_7__.Provider.isProvider(configOrProvider)) { const stallTimeout = (0,_formatter__WEBPACK_IMPORTED_MODULE_8__/* .isCommunityResource */ .Gp)(configOrProvider) ? 2000 : 750; const priority = 1; return Object.freeze({ provider: configOrProvider, weight: 1, stallTimeout, priority }); } const config = (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.shallowCopy)(configOrProvider); if (config.priority == null) { config.priority = 1; } if (config.stallTimeout == null) { config.stallTimeout = (0,_formatter__WEBPACK_IMPORTED_MODULE_8__/* .isCommunityResource */ .Gp)(configOrProvider) ? 2000 : 750; } if (config.weight == null) { config.weight = 1; } const weight = config.weight; if (weight % 1 || weight > 512 || weight < 1) { logger.throwArgumentError("invalid weight; must be integer in [1, 512]", `providers[${index}].weight`, weight); } return Object.freeze(config); }); const total = providerConfigs.reduce((accum, c) => (accum + c.weight), 0); if (quorum == null) { quorum = total / 2; } else if (quorum > total) { logger.throwArgumentError("quorum will always fail; larger than total weight", "quorum", quorum); } // Are all providers' networks are known let networkOrReady = checkNetworks(providerConfigs.map((c) => (c.provider).network)); // Not all networks are known; we must stall if (networkOrReady == null) { networkOrReady = new Promise((resolve, reject) => { setTimeout(() => { this.detectNetwork().then(resolve, reject); }, 0); }); } super(networkOrReady); // Preserve a copy, so we do not get mutated (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.defineReadOnly)(this, "providerConfigs", Object.freeze(providerConfigs)); (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.defineReadOnly)(this, "quorum", quorum); this._highestBlockNumber = -1; } detectNetwork() { return __awaiter(this, void 0, void 0, function* () { const networks = yield Promise.all(this.providerConfigs.map((c) => c.provider.getNetwork())); return checkNetworks(networks); }); } perform(method, params) { return __awaiter(this, void 0, void 0, function* () { // Sending transactions is special; always broadcast it to all backends if (method === "sendTransaction") { const results = yield Promise.all(this.providerConfigs.map((c) => { return c.provider.sendTransaction(params.signedTransaction).then((result) => { return result.hash; }, (error) => { return error; }); })); // Any success is good enough (other errors are likely "already seen" errors for (let i = 0; i < results.length; i++) { const result = results[i]; if (typeof (result) === "string") { return result; } } // They were all an error; pick the first error throw results[0]; } // We need to make sure we are in sync with our backends, so we need // to know this before we can make a lot of calls if (this._highestBlockNumber === -1 && method !== "getBlockNumber") { yield this.getBlockNumber(); } const processFunc = getProcessFunc(this, method, params); // Shuffle the providers and then sort them by their priority; we // shallowCopy them since we will store the result in them too const configs = (0,_ethersproject_random__WEBPACK_IMPORTED_MODULE_9__/* .shuffled */ .y)(this.providerConfigs.map(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.shallowCopy)); configs.sort((a, b) => (a.priority - b.priority)); const currentBlockNumber = this._highestBlockNumber; let i = 0; let first = true; while (true) { const t0 = now(); // Compute the inflight weight (exclude anything past) let inflightWeight = configs.filter((c) => (c.runner && ((t0 - c.start) < c.stallTimeout))) .reduce((accum, c) => (accum + c.weight), 0); // Start running enough to meet quorum while (inflightWeight < this.quorum && i < configs.length) { const config = configs[i++]; const rid = nextRid++; config.start = now(); config.staller = stall(config.stallTimeout); config.staller.wait(() => { config.staller = null; }); config.runner = getRunner(config, currentBlockNumber, method, params).then((result) => { config.done = true; config.result = result; if (this.listenerCount("debug")) { this.emit("debug", { action: "request", rid: rid, backend: exposeDebugConfig(config, now()), request: { method: method, params: (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.deepCopy)(params) }, provider: this }); } }, (error) => { config.done = true; config.error = error; if (this.listenerCount("debug")) { this.emit("debug", { action: "request", rid: rid, backend: exposeDebugConfig(config, now()), request: { method: method, params: (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.deepCopy)(params) }, provider: this }); } }); if (this.listenerCount("debug")) { this.emit("debug", { action: "request", rid: rid, backend: exposeDebugConfig(config, null), request: { method: method, params: (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.deepCopy)(params) }, provider: this }); } inflightWeight += config.weight; } // Wait for anything meaningful to finish or stall out const waiting = []; configs.forEach((c) => { if (c.done || !c.runner) { return; } waiting.push(c.runner); if (c.staller) { waiting.push(c.staller.getPromise()); } }); if (waiting.length) { yield Promise.race(waiting); } // Check the quorum and process the results; the process function // may additionally decide the quorum is not met const results = configs.filter((c) => (c.done && c.error == null)); if (results.length >= this.quorum) { const result = processFunc(results); if (result !== undefined) { // Shut down any stallers configs.forEach(c => { if (c.staller) { c.staller.cancel(); } c.cancelled = true; }); return result; } if (!first) { yield stall(100).getPromise(); } first = false; } // No result, check for errors that should be forwarded const errors = configs.reduce((accum, c) => { if (!c.done || c.error == null) { return accum; } const code = (c.error).code; if (ForwardErrors.indexOf(code) >= 0) { if (!accum[code]) { accum[code] = { error: c.error, weight: 0 }; } accum[code].weight += c.weight; } return accum; }, ({})); Object.keys(errors).forEach((errorCode) => { const tally = errors[errorCode]; if (tally.weight < this.quorum) { return; } // Shut down any stallers configs.forEach(c => { if (c.staller) { c.staller.cancel(); } c.cancelled = true; }); const e = (tally.error); const props = {}; ForwardProperties.forEach((name) => { if (e[name] == null) { return; } props[name] = e[name]; }); logger.throwError(e.reason || e.message, errorCode, props); }); // All configs have run to completion; we will never get more data if (configs.filter((c) => !c.done).length === 0) { break; } } // Shut down any stallers; shouldn't be any configs.forEach(c => { if (c.staller) { c.staller.cancel(); } c.cancelled = true; }); return logger.throwError("failed to meet quorum", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.SERVER_ERROR, { method: method, params: params, //results: configs.map((c) => c.result), //errors: configs.map((c) => c.error), results: configs.map((c) => exposeDebugConfig(c)), provider: this }); }); } } //# sourceMappingURL=fallback-provider.js.map /***/ }), /***/ 30032: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Ed": function() { return /* binding */ isCommunityResourcable; }, /* harmony export */ "Gp": function() { return /* binding */ isCommunityResource; }, /* harmony export */ "Mb": function() { return /* binding */ Formatter; }, /* harmony export */ "vh": function() { return /* binding */ showThrottleMessage; } /* harmony export */ }); /* harmony import */ var _ethersproject_address__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(19485); /* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2593); /* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(16441); /* harmony import */ var _ethersproject_constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(9279); /* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6881); /* harmony import */ var _ethersproject_transactions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(83875); /* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1581); /* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(34216); const logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__/* .version */ .i); class Formatter { constructor() { this.formats = this.getDefaultFormats(); } getDefaultFormats() { const formats = ({}); const address = this.address.bind(this); const bigNumber = this.bigNumber.bind(this); const blockTag = this.blockTag.bind(this); const data = this.data.bind(this); const hash = this.hash.bind(this); const hex = this.hex.bind(this); const number = this.number.bind(this); const type = this.type.bind(this); const strictData = (v) => { return this.data(v, true); }; formats.transaction = { hash: hash, type: type, accessList: Formatter.allowNull(this.accessList.bind(this), null), blockHash: Formatter.allowNull(hash, null), blockNumber: Formatter.allowNull(number, null), transactionIndex: Formatter.allowNull(number, null), confirmations: Formatter.allowNull(number, null), from: address, // either (gasPrice) or (maxPriorityFeePerGas + maxFeePerGas) // must be set gasPrice: Formatter.allowNull(bigNumber), maxPriorityFeePerGas: Formatter.allowNull(bigNumber), maxFeePerGas: Formatter.allowNull(bigNumber), gasLimit: bigNumber, to: Formatter.allowNull(address, null), value: bigNumber, nonce: number, data: data, r: Formatter.allowNull(this.uint256), s: Formatter.allowNull(this.uint256), v: Formatter.allowNull(number), creates: Formatter.allowNull(address, null), raw: Formatter.allowNull(data), }; formats.transactionRequest = { from: Formatter.allowNull(address), nonce: Formatter.allowNull(number), gasLimit: Formatter.allowNull(bigNumber), gasPrice: Formatter.allowNull(bigNumber), maxPriorityFeePerGas: Formatter.allowNull(bigNumber), maxFeePerGas: Formatter.allowNull(bigNumber), to: Formatter.allowNull(address), value: Formatter.allowNull(bigNumber), data: Formatter.allowNull(strictData), type: Formatter.allowNull(number), accessList: Formatter.allowNull(this.accessList.bind(this), null), }; formats.receiptLog = { transactionIndex: number, blockNumber: number, transactionHash: hash, address: address, topics: Formatter.arrayOf(hash), data: data, logIndex: number, blockHash: hash, }; formats.receipt = { to: Formatter.allowNull(this.address, null), from: Formatter.allowNull(this.address, null), contractAddress: Formatter.allowNull(address, null), transactionIndex: number, // should be allowNull(hash), but broken-EIP-658 support is handled in receipt root: Formatter.allowNull(hex), gasUsed: bigNumber, logsBloom: Formatter.allowNull(data), blockHash: hash, transactionHash: hash, logs: Formatter.arrayOf(this.receiptLog.bind(this)), blockNumber: number, confirmations: Formatter.allowNull(number, null), cumulativeGasUsed: bigNumber, effectiveGasPrice: Formatter.allowNull(bigNumber), status: Formatter.allowNull(number), type: type }; formats.block = { hash: Formatter.allowNull(hash), parentHash: hash, number: number, timestamp: number, nonce: Formatter.allowNull(hex), difficulty: this.difficulty.bind(this), gasLimit: bigNumber, gasUsed: bigNumber, miner: Formatter.allowNull(address), extraData: data, transactions: Formatter.allowNull(Formatter.arrayOf(hash)), baseFeePerGas: Formatter.allowNull(bigNumber) }; formats.blockWithTransactions = (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.shallowCopy)(formats.block); formats.blockWithTransactions.transactions = Formatter.allowNull(Formatter.arrayOf(this.transactionResponse.bind(this))); formats.filter = { fromBlock: Formatter.allowNull(blockTag, undefined), toBlock: Formatter.allowNull(blockTag, undefined), blockHash: Formatter.allowNull(hash, undefined), address: Formatter.allowNull(address, undefined), topics: Formatter.allowNull(this.topics.bind(this), undefined), }; formats.filterLog = { blockNumber: Formatter.allowNull(number), blockHash: Formatter.allowNull(hash), transactionIndex: number, removed: Formatter.allowNull(this.boolean.bind(this)), address: address, data: Formatter.allowFalsish(data, "0x"), topics: Formatter.arrayOf(hash), transactionHash: hash, logIndex: number, }; return formats; } accessList(accessList) { return (0,_ethersproject_transactions__WEBPACK_IMPORTED_MODULE_3__.accessListify)(accessList || []); } // Requires a BigNumberish that is within the IEEE754 safe integer range; returns a number // Strict! Used on input. number(number) { if (number === "0x") { return 0; } return _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__/* .BigNumber.from */ .O$.from(number).toNumber(); } type(number) { if (number === "0x" || number == null) { return 0; } return _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__/* .BigNumber.from */ .O$.from(number).toNumber(); } // Strict! Used on input. bigNumber(value) { return _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__/* .BigNumber.from */ .O$.from(value); } // Requires a boolean, "true" or "false"; returns a boolean boolean(value) { if (typeof (value) === "boolean") { return value; } if (typeof (value) === "string") { value = value.toLowerCase(); if (value === "true") { return true; } if (value === "false") { return false; } } throw new Error("invalid boolean - " + value); } hex(value, strict) { if (typeof (value) === "string") { if (!strict && value.substring(0, 2) !== "0x") { value = "0x" + value; } if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_5__.isHexString)(value)) { return value.toLowerCase(); } } return logger.throwArgumentError("invalid hash", "value", value); } data(value, strict) { const result = this.hex(value, strict); if ((result.length % 2) !== 0) { throw new Error("invalid data; odd-length - " + value); } return result; } // Requires an address // Strict! Used on input. address(value) { return (0,_ethersproject_address__WEBPACK_IMPORTED_MODULE_6__.getAddress)(value); } callAddress(value) { if (!(0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_5__.isHexString)(value, 32)) { return null; } const address = (0,_ethersproject_address__WEBPACK_IMPORTED_MODULE_6__.getAddress)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_5__.hexDataSlice)(value, 12)); return (address === _ethersproject_constants__WEBPACK_IMPORTED_MODULE_7__/* .AddressZero */ .d) ? null : address; } contractAddress(value) { return (0,_ethersproject_address__WEBPACK_IMPORTED_MODULE_6__.getContractAddress)(value); } // Strict! Used on input. blockTag(blockTag) { if (blockTag == null) { return "latest"; } if (blockTag === "earliest") { return "0x0"; } if (blockTag === "latest" || blockTag === "pending") { return blockTag; } if (typeof (blockTag) === "number" || (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_5__.isHexString)(blockTag)) { return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_5__.hexValue)(blockTag); } throw new Error("invalid blockTag"); } // Requires a hash, optionally requires 0x prefix; returns prefixed lowercase hash. hash(value, strict) { const result = this.hex(value, strict); if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_5__.hexDataLength)(result) !== 32) { return logger.throwArgumentError("invalid hash", "value", value); } return result; } // Returns the difficulty as a number, or if too large (i.e. PoA network) null difficulty(value) { if (value == null) { return null; } const v = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__/* .BigNumber.from */ .O$.from(value); try { return v.toNumber(); } catch (error) { } return null; } uint256(value) { if (!(0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_5__.isHexString)(value)) { throw new Error("invalid uint256"); } return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_5__.hexZeroPad)(value, 32); } _block(value, format) { if (value.author != null && value.miner == null) { value.miner = value.author; } // The difficulty may need to come from _difficulty in recursed blocks const difficulty = (value._difficulty != null) ? value._difficulty : value.difficulty; const result = Formatter.check(format, value); result._difficulty = ((difficulty == null) ? null : _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__/* .BigNumber.from */ .O$.from(difficulty)); return result; } block(value) { return this._block(value, this.formats.block); } blockWithTransactions(value) { return this._block(value, this.formats.blockWithTransactions); } // Strict! Used on input. transactionRequest(value) { return Formatter.check(this.formats.transactionRequest, value); } transactionResponse(transaction) { // Rename gas to gasLimit if (transaction.gas != null && transaction.gasLimit == null) { transaction.gasLimit = transaction.gas; } // Some clients (TestRPC) do strange things like return 0x0 for the // 0 address; correct this to be a real address if (transaction.to && _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__/* .BigNumber.from */ .O$.from(transaction.to).isZero()) { transaction.to = "0x0000000000000000000000000000000000000000"; } // Rename input to data if (transaction.input != null && transaction.data == null) { transaction.data = transaction.input; } // If to and creates are empty, populate the creates from the transaction if (transaction.to == null && transaction.creates == null) { transaction.creates = this.contractAddress(transaction); } if ((transaction.type === 1 || transaction.type === 2) && transaction.accessList == null) { transaction.accessList = []; } const result = Formatter.check(this.formats.transaction, transaction); if (transaction.chainId != null) { let chainId = transaction.chainId; if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_5__.isHexString)(chainId)) { chainId = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__/* .BigNumber.from */ .O$.from(chainId).toNumber(); } result.chainId = chainId; } else { let chainId = transaction.networkId; // geth-etc returns chainId if (chainId == null && result.v == null) { chainId = transaction.chainId; } if ((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_5__.isHexString)(chainId)) { chainId = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__/* .BigNumber.from */ .O$.from(chainId).toNumber(); } if (typeof (chainId) !== "number" && result.v != null) { chainId = (result.v - 35) / 2; if (chainId < 0) { chainId = 0; } chainId = parseInt(chainId); } if (typeof (chainId) !== "number") { chainId = 0; } result.chainId = chainId; } // 0x0000... should actually be null if (result.blockHash && result.blockHash.replace(/0/g, "") === "x") { result.blockHash = null; } return result; } transaction(value) { return (0,_ethersproject_transactions__WEBPACK_IMPORTED_MODULE_3__.parse)(value); } receiptLog(value) { return Formatter.check(this.formats.receiptLog, value); } receipt(value) { const result = Formatter.check(this.formats.receipt, value); // RSK incorrectly implemented EIP-658, so we munge things a bit here for it if (result.root != null) { if (result.root.length <= 4) { // Could be 0x00, 0x0, 0x01 or 0x1 const value = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__/* .BigNumber.from */ .O$.from(result.root).toNumber(); if (value === 0 || value === 1) { // Make sure if both are specified, they match if (result.status != null && (result.status !== value)) { logger.throwArgumentError("alt-root-status/status mismatch", "value", { root: result.root, status: result.status }); } result.status = value; delete result.root; } else { logger.throwArgumentError("invalid alt-root-status", "value.root", result.root); } } else if (result.root.length !== 66) { // Must be a valid bytes32 logger.throwArgumentError("invalid root hash", "value.root", result.root); } } if (result.status != null) { result.byzantium = true; } return result; } topics(value) { if (Array.isArray(value)) { return value.map((v) => this.topics(v)); } else if (value != null) { return this.hash(value, true); } return null; } filter(value) { return Formatter.check(this.formats.filter, value); } filterLog(value) { return Formatter.check(this.formats.filterLog, value); } static check(format, object) { const result = {}; for (const key in format) { try { const value = format[key](object[key]); if (value !== undefined) { result[key] = value; } } catch (error) { error.checkKey = key; error.checkValue = object[key]; throw error; } } return result; } // if value is null-ish, nullValue is returned static allowNull(format, nullValue) { return (function (value) { if (value == null) { return nullValue; } return format(value); }); } // If value is false-ish, replaceValue is returned static allowFalsish(format, replaceValue) { return (function (value) { if (!value) { return replaceValue; } return format(value); }); } // Requires an Array satisfying check static arrayOf(format) { return (function (array) { if (!Array.isArray(array)) { throw new Error("not an array"); } const result = []; array.forEach(function (value) { result.push(format(value)); }); return result; }); } } function isCommunityResourcable(value) { return (value && typeof (value.isCommunityResource) === "function"); } function isCommunityResource(value) { return (isCommunityResourcable(value) && value.isCommunityResource()); } // Show the throttle message only once let throttleMessage = false; function showThrottleMessage() { if (throttleMessage) { return; } throttleMessage = true; console.log("========= NOTICE ========="); console.log("Request-Rate Exceeded (this message will not be repeated)"); console.log(""); console.log("The default API keys for each service are provided as a highly-throttled,"); console.log("community resource for low-traffic projects and early prototyping."); console.log(""); console.log("While your application will continue to function, we highly recommended"); console.log("signing up for your own API keys to improve performance, increase your"); console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."); console.log(""); console.log("For more details: https:/\/docs.ethers.io/api-keys/"); console.log("=========================="); } //# sourceMappingURL=formatter.js.map /***/ }), /***/ 88901: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { "AlchemyProvider": function() { return /* reexport */ AlchemyProvider; }, "AlchemyWebSocketProvider": function() { return /* reexport */ AlchemyWebSocketProvider; }, "AnkrProvider": function() { return /* reexport */ AnkrProvider; }, "BaseProvider": function() { return /* reexport */ base_provider/* BaseProvider */.Zk; }, "CloudflareProvider": function() { return /* reexport */ CloudflareProvider; }, "EtherscanProvider": function() { return /* reexport */ EtherscanProvider; }, "FallbackProvider": function() { return /* reexport */ fallback_provider/* FallbackProvider */.H; }, "Formatter": function() { return /* reexport */ formatter/* Formatter */.Mb; }, "InfuraProvider": function() { return /* reexport */ InfuraProvider; }, "InfuraWebSocketProvider": function() { return /* reexport */ InfuraWebSocketProvider; }, "IpcProvider": function() { return /* reexport */ IpcProvider; }, "JsonRpcBatchProvider": function() { return /* reexport */ JsonRpcBatchProvider; }, "JsonRpcProvider": function() { return /* reexport */ json_rpc_provider/* JsonRpcProvider */.r; }, "JsonRpcSigner": function() { return /* reexport */ json_rpc_provider/* JsonRpcSigner */.C; }, "NodesmithProvider": function() { return /* reexport */ NodesmithProvider; }, "PocketProvider": function() { return /* reexport */ PocketProvider; }, "Provider": function() { return /* reexport */ lib_esm.Provider; }, "Resolver": function() { return /* reexport */ base_provider/* Resolver */.H2; }, "StaticJsonRpcProvider": function() { return /* reexport */ url_json_rpc_provider/* StaticJsonRpcProvider */.c; }, "UrlJsonRpcProvider": function() { return /* reexport */ url_json_rpc_provider/* UrlJsonRpcProvider */.l; }, "Web3Provider": function() { return /* reexport */ web3_provider/* Web3Provider */.Q; }, "WebSocketProvider": function() { return /* reexport */ websocket_provider/* WebSocketProvider */.q; }, "getDefaultProvider": function() { return /* binding */ getDefaultProvider; }, "getNetwork": function() { return /* reexport */ networks_lib_esm/* getNetwork */.H; }, "isCommunityResourcable": function() { return /* reexport */ formatter/* isCommunityResourcable */.Ed; }, "isCommunityResource": function() { return /* reexport */ formatter/* isCommunityResource */.Gp; }, "showThrottleMessage": function() { return /* reexport */ formatter/* showThrottleMessage */.vh; } }); // EXTERNAL MODULE: ./node_modules/@ethersproject/abstract-provider/lib.esm/index.js + 1 modules var lib_esm = __webpack_require__(81556); // EXTERNAL MODULE: ./node_modules/@ethersproject/networks/lib.esm/index.js + 1 modules var networks_lib_esm = __webpack_require__(45710); // EXTERNAL MODULE: ./node_modules/@ethersproject/providers/lib.esm/base-provider.js var base_provider = __webpack_require__(75361); // EXTERNAL MODULE: ./node_modules/@ethersproject/properties/lib.esm/index.js + 1 modules var properties_lib_esm = __webpack_require__(6881); // EXTERNAL MODULE: ./node_modules/@ethersproject/providers/lib.esm/formatter.js var formatter = __webpack_require__(30032); // EXTERNAL MODULE: ./node_modules/@ethersproject/providers/lib.esm/websocket-provider.js + 1 modules var websocket_provider = __webpack_require__(88089); // EXTERNAL MODULE: ./node_modules/@ethersproject/logger/lib.esm/index.js + 1 modules var logger_lib_esm = __webpack_require__(1581); // EXTERNAL MODULE: ./node_modules/@ethersproject/providers/lib.esm/_version.js var _version = __webpack_require__(34216); // EXTERNAL MODULE: ./node_modules/@ethersproject/providers/lib.esm/url-json-rpc-provider.js var url_json_rpc_provider = __webpack_require__(93901); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/providers/lib.esm/alchemy-provider.js const logger = new logger_lib_esm.Logger(_version/* version */.i); // This key was provided to ethers.js by Alchemy to be used by the // default provider, but it is recommended that for your own // production environments, that you acquire your own API key at: // https://dashboard.alchemyapi.io const defaultApiKey = "_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC"; class AlchemyWebSocketProvider extends websocket_provider/* WebSocketProvider */.q { constructor(network, apiKey) { const provider = new AlchemyProvider(network, apiKey); const url = provider.connection.url.replace(/^http/i, "ws") .replace(".alchemyapi.", ".ws.alchemyapi."); super(url, provider.network); (0,properties_lib_esm.defineReadOnly)(this, "apiKey", provider.apiKey); } isCommunityResource() { return (this.apiKey === defaultApiKey); } } class AlchemyProvider extends url_json_rpc_provider/* UrlJsonRpcProvider */.l { static getWebSocketProvider(network, apiKey) { return new AlchemyWebSocketProvider(network, apiKey); } static getApiKey(apiKey) { if (apiKey == null) { return defaultApiKey; } if (apiKey && typeof (apiKey) !== "string") { logger.throwArgumentError("invalid apiKey", "apiKey", apiKey); } return apiKey; } static getUrl(network, apiKey) { let host = null; switch (network.name) { case "homestead": host = "eth-mainnet.alchemyapi.io/v2/"; break; case "ropsten": host = "eth-ropsten.alchemyapi.io/v2/"; break; case "rinkeby": host = "eth-rinkeby.alchemyapi.io/v2/"; break; case "goerli": host = "eth-goerli.alchemyapi.io/v2/"; break; case "kovan": host = "eth-kovan.alchemyapi.io/v2/"; break; case "matic": host = "polygon-mainnet.g.alchemy.com/v2/"; break; case "maticmum": host = "polygon-mumbai.g.alchemy.com/v2/"; break; case "arbitrum": host = "arb-mainnet.g.alchemy.com/v2/"; break; case "arbitrum-rinkeby": host = "arb-rinkeby.g.alchemy.com/v2/"; break; case "optimism": host = "opt-mainnet.g.alchemy.com/v2/"; break; case "optimism-kovan": host = "opt-kovan.g.alchemy.com/v2/"; break; default: logger.throwArgumentError("unsupported network", "network", arguments[0]); } return { allowGzip: true, url: ("https:/" + "/" + host + apiKey), throttleCallback: (attempt, url) => { if (apiKey === defaultApiKey) { (0,formatter/* showThrottleMessage */.vh)(); } return Promise.resolve(true); } }; } isCommunityResource() { return (this.apiKey === defaultApiKey); } } //# sourceMappingURL=alchemy-provider.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/providers/lib.esm/ankr-provider.js const ankr_provider_logger = new logger_lib_esm.Logger(_version/* version */.i); const ankr_provider_defaultApiKey = "9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972"; function getHost(name) { switch (name) { case "homestead": return "rpc.ankr.com/eth/"; case "ropsten": return "rpc.ankr.com/eth_ropsten/"; case "rinkeby": return "rpc.ankr.com/eth_rinkeby/"; case "goerli": return "rpc.ankr.com/eth_goerli/"; case "matic": return "rpc.ankr.com/polygon/"; case "arbitrum": return "rpc.ankr.com/arbitrum/"; } return ankr_provider_logger.throwArgumentError("unsupported network", "name", name); } class AnkrProvider extends url_json_rpc_provider/* UrlJsonRpcProvider */.l { isCommunityResource() { return (this.apiKey === ankr_provider_defaultApiKey); } static getApiKey(apiKey) { if (apiKey == null) { return ankr_provider_defaultApiKey; } return apiKey; } static getUrl(network, apiKey) { if (apiKey == null) { apiKey = ankr_provider_defaultApiKey; } const connection = { allowGzip: true, url: ("https:/\/" + getHost(network.name) + apiKey), throttleCallback: (attempt, url) => { if (apiKey.apiKey === ankr_provider_defaultApiKey) { (0,formatter/* showThrottleMessage */.vh)(); } return Promise.resolve(true); } }; if (apiKey.projectSecret != null) { connection.user = ""; connection.password = apiKey.projectSecret; } return connection; } } //# sourceMappingURL=ankr-provider.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/providers/lib.esm/cloudflare-provider.js var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; const cloudflare_provider_logger = new logger_lib_esm.Logger(_version/* version */.i); class CloudflareProvider extends url_json_rpc_provider/* UrlJsonRpcProvider */.l { static getApiKey(apiKey) { if (apiKey != null) { cloudflare_provider_logger.throwArgumentError("apiKey not supported for cloudflare", "apiKey", apiKey); } return null; } static getUrl(network, apiKey) { let host = null; switch (network.name) { case "homestead": host = "https://cloudflare-eth.com/"; break; default: cloudflare_provider_logger.throwArgumentError("unsupported network", "network", arguments[0]); } return host; } perform(method, params) { const _super = Object.create(null, { perform: { get: () => super.perform } }); return __awaiter(this, void 0, void 0, function* () { // The Cloudflare provider does not support eth_blockNumber, // so we get the latest block and pull it from that if (method === "getBlockNumber") { const block = yield _super.perform.call(this, "getBlock", { blockTag: "latest" }); return block.number; } return _super.perform.call(this, method, params); }); } } //# sourceMappingURL=cloudflare-provider.js.map // EXTERNAL MODULE: ./node_modules/@ethersproject/bytes/lib.esm/index.js + 1 modules var bytes_lib_esm = __webpack_require__(16441); // EXTERNAL MODULE: ./node_modules/@ethersproject/transactions/lib.esm/index.js + 1 modules var transactions_lib_esm = __webpack_require__(83875); // EXTERNAL MODULE: ./node_modules/@ethersproject/web/lib.esm/index.js + 2 modules var web_lib_esm = __webpack_require__(37707); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/providers/lib.esm/etherscan-provider.js var etherscan_provider_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; const etherscan_provider_logger = new logger_lib_esm.Logger(_version/* version */.i); // The transaction has already been sanitized by the calls in Provider function getTransactionPostData(transaction) { const result = {}; for (let key in transaction) { if (transaction[key] == null) { continue; } let value = transaction[key]; if (key === "type" && value === 0) { continue; } // Quantity-types require no leading zero, unless 0 if ({ type: true, gasLimit: true, gasPrice: true, maxFeePerGs: true, maxPriorityFeePerGas: true, nonce: true, value: true }[key]) { value = (0,bytes_lib_esm.hexValue)((0,bytes_lib_esm.hexlify)(value)); } else if (key === "accessList") { value = "[" + (0,transactions_lib_esm.accessListify)(value).map((set) => { return `{address:"${set.address}",storageKeys:["${set.storageKeys.join('","')}"]}`; }).join(",") + "]"; } else { value = (0,bytes_lib_esm.hexlify)(value); } result[key] = value; } return result; } function getResult(result) { // getLogs, getHistory have weird success responses if (result.status == 0 && (result.message === "No records found" || result.message === "No transactions found")) { return result.result; } if (result.status != 1 || result.message != "OK") { const error = new Error("invalid response"); error.result = JSON.stringify(result); if ((result.result || "").toLowerCase().indexOf("rate limit") >= 0) { error.throttleRetry = true; } throw error; } return result.result; } function getJsonResult(result) { // This response indicates we are being throttled if (result && result.status == 0 && result.message == "NOTOK" && (result.result || "").toLowerCase().indexOf("rate limit") >= 0) { const error = new Error("throttled response"); error.result = JSON.stringify(result); error.throttleRetry = true; throw error; } if (result.jsonrpc != "2.0") { // @TODO: not any const error = new Error("invalid response"); error.result = JSON.stringify(result); throw error; } if (result.error) { // @TODO: not any const error = new Error(result.error.message || "unknown error"); if (result.error.code) { error.code = result.error.code; } if (result.error.data) { error.data = result.error.data; } throw error; } return result.result; } // The blockTag was normalized as a string by the Provider pre-perform operations function checkLogTag(blockTag) { if (blockTag === "pending") { throw new Error("pending not supported"); } if (blockTag === "latest") { return blockTag; } return parseInt(blockTag.substring(2), 16); } const etherscan_provider_defaultApiKey = "9D13ZE7XSBTJ94N9BNJ2MA33VMAY2YPIRB"; function checkError(method, error, transaction) { // Undo the "convenience" some nodes are attempting to prevent backwards // incompatibility; maybe for v6 consider forwarding reverts as errors if (method === "call" && error.code === logger_lib_esm.Logger.errors.SERVER_ERROR) { const e = error.error; // Etherscan keeps changing their string if (e && (e.message.match(/reverted/i) || e.message.match(/VM execution error/i))) { // Etherscan prefixes the data like "Reverted 0x1234" let data = e.data; if (data) { data = "0x" + data.replace(/^.*0x/i, ""); } if ((0,bytes_lib_esm.isHexString)(data)) { return data; } etherscan_provider_logger.throwError("missing revert data in call exception", logger_lib_esm.Logger.errors.CALL_EXCEPTION, { error, data: "0x" }); } } // Get the message from any nested error structure let message = error.message; if (error.code === logger_lib_esm.Logger.errors.SERVER_ERROR) { if (error.error && typeof (error.error.message) === "string") { message = error.error.message; } else if (typeof (error.body) === "string") { message = error.body; } else if (typeof (error.responseText) === "string") { message = error.responseText; } } message = (message || "").toLowerCase(); // "Insufficient funds. The account you tried to send transaction from does not have enough funds. Required 21464000000000 and got: 0" if (message.match(/insufficient funds/)) { etherscan_provider_logger.throwError("insufficient funds for intrinsic transaction cost", logger_lib_esm.Logger.errors.INSUFFICIENT_FUNDS, { error, method, transaction }); } // "Transaction with the same hash was already imported." if (message.match(/same hash was already imported|transaction nonce is too low|nonce too low/)) { etherscan_provider_logger.throwError("nonce has already been used", logger_lib_esm.Logger.errors.NONCE_EXPIRED, { error, method, transaction }); } // "Transaction gas price is too low. There is another transaction with same nonce in the queue. Try increasing the gas price or incrementing the nonce." if (message.match(/another transaction with same nonce/)) { etherscan_provider_logger.throwError("replacement fee too low", logger_lib_esm.Logger.errors.REPLACEMENT_UNDERPRICED, { error, method, transaction }); } if (message.match(/execution failed due to an exception|execution reverted/)) { etherscan_provider_logger.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", logger_lib_esm.Logger.errors.UNPREDICTABLE_GAS_LIMIT, { error, method, transaction }); } throw error; } class EtherscanProvider extends base_provider/* BaseProvider */.Zk { constructor(network, apiKey) { super(network); (0,properties_lib_esm.defineReadOnly)(this, "baseUrl", this.getBaseUrl()); (0,properties_lib_esm.defineReadOnly)(this, "apiKey", apiKey || etherscan_provider_defaultApiKey); } getBaseUrl() { switch (this.network ? this.network.name : "invalid") { case "homestead": return "https:/\/api.etherscan.io"; case "ropsten": return "https:/\/api-ropsten.etherscan.io"; case "rinkeby": return "https:/\/api-rinkeby.etherscan.io"; case "kovan": return "https:/\/api-kovan.etherscan.io"; case "goerli": return "https:/\/api-goerli.etherscan.io"; case "optimism": return "https:/\/api-optimistic.etherscan.io"; default: } return etherscan_provider_logger.throwArgumentError("unsupported network", "network", this.network.name); } getUrl(module, params) { const query = Object.keys(params).reduce((accum, key) => { const value = params[key]; if (value != null) { accum += `&${key}=${value}`; } return accum; }, ""); const apiKey = ((this.apiKey) ? `&apikey=${this.apiKey}` : ""); return `${this.baseUrl}/api?module=${module}${query}${apiKey}`; } getPostUrl() { return `${this.baseUrl}/api`; } getPostData(module, params) { params.module = module; params.apikey = this.apiKey; return params; } fetch(module, params, post) { return etherscan_provider_awaiter(this, void 0, void 0, function* () { const url = (post ? this.getPostUrl() : this.getUrl(module, params)); const payload = (post ? this.getPostData(module, params) : null); const procFunc = (module === "proxy") ? getJsonResult : getResult; this.emit("debug", { action: "request", request: url, provider: this }); const connection = { url: url, throttleSlotInterval: 1000, throttleCallback: (attempt, url) => { if (this.isCommunityResource()) { (0,formatter/* showThrottleMessage */.vh)(); } return Promise.resolve(true); } }; let payloadStr = null; if (payload) { connection.headers = { "content-type": "application/x-www-form-urlencoded; charset=UTF-8" }; payloadStr = Object.keys(payload).map((key) => { return `${key}=${payload[key]}`; }).join("&"); } const result = yield (0,web_lib_esm.fetchJson)(connection, payloadStr, procFunc || getJsonResult); this.emit("debug", { action: "response", request: url, response: (0,properties_lib_esm.deepCopy)(result), provider: this }); return result; }); } detectNetwork() { return etherscan_provider_awaiter(this, void 0, void 0, function* () { return this.network; }); } perform(method, params) { const _super = Object.create(null, { perform: { get: () => super.perform } }); return etherscan_provider_awaiter(this, void 0, void 0, function* () { switch (method) { case "getBlockNumber": return this.fetch("proxy", { action: "eth_blockNumber" }); case "getGasPrice": return this.fetch("proxy", { action: "eth_gasPrice" }); case "getBalance": // Returns base-10 result return this.fetch("account", { action: "balance", address: params.address, tag: params.blockTag }); case "getTransactionCount": return this.fetch("proxy", { action: "eth_getTransactionCount", address: params.address, tag: params.blockTag }); case "getCode": return this.fetch("proxy", { action: "eth_getCode", address: params.address, tag: params.blockTag }); case "getStorageAt": return this.fetch("proxy", { action: "eth_getStorageAt", address: params.address, position: params.position, tag: params.blockTag }); case "sendTransaction": return this.fetch("proxy", { action: "eth_sendRawTransaction", hex: params.signedTransaction }, true).catch((error) => { return checkError("sendTransaction", error, params.signedTransaction); }); case "getBlock": if (params.blockTag) { return this.fetch("proxy", { action: "eth_getBlockByNumber", tag: params.blockTag, boolean: (params.includeTransactions ? "true" : "false") }); } throw new Error("getBlock by blockHash not implemented"); case "getTransaction": return this.fetch("proxy", { action: "eth_getTransactionByHash", txhash: params.transactionHash }); case "getTransactionReceipt": return this.fetch("proxy", { action: "eth_getTransactionReceipt", txhash: params.transactionHash }); case "call": { if (params.blockTag !== "latest") { throw new Error("EtherscanProvider does not support blockTag for call"); } const postData = getTransactionPostData(params.transaction); postData.module = "proxy"; postData.action = "eth_call"; try { return yield this.fetch("proxy", postData, true); } catch (error) { return checkError("call", error, params.transaction); } } case "estimateGas": { const postData = getTransactionPostData(params.transaction); postData.module = "proxy"; postData.action = "eth_estimateGas"; try { return yield this.fetch("proxy", postData, true); } catch (error) { return checkError("estimateGas", error, params.transaction); } } case "getLogs": { const args = { action: "getLogs" }; if (params.filter.fromBlock) { args.fromBlock = checkLogTag(params.filter.fromBlock); } if (params.filter.toBlock) { args.toBlock = checkLogTag(params.filter.toBlock); } if (params.filter.address) { args.address = params.filter.address; } // @TODO: We can handle slightly more complicated logs using the logs API if (params.filter.topics && params.filter.topics.length > 0) { if (params.filter.topics.length > 1) { etherscan_provider_logger.throwError("unsupported topic count", logger_lib_esm.Logger.errors.UNSUPPORTED_OPERATION, { topics: params.filter.topics }); } if (params.filter.topics.length === 1) { const topic0 = params.filter.topics[0]; if (typeof (topic0) !== "string" || topic0.length !== 66) { etherscan_provider_logger.throwError("unsupported topic format", logger_lib_esm.Logger.errors.UNSUPPORTED_OPERATION, { topic0: topic0 }); } args.topic0 = topic0; } } const logs = yield this.fetch("logs", args); // Cache txHash => blockHash let blocks = {}; // Add any missing blockHash to the logs for (let i = 0; i < logs.length; i++) { const log = logs[i]; if (log.blockHash != null) { continue; } if (blocks[log.blockNumber] == null) { const block = yield this.getBlock(log.blockNumber); if (block) { blocks[log.blockNumber] = block.hash; } } log.blockHash = blocks[log.blockNumber]; } return logs; } case "getEtherPrice": if (this.network.name !== "homestead") { return 0.0; } return parseFloat((yield this.fetch("stats", { action: "ethprice" })).ethusd); default: break; } return _super.perform.call(this, method, params); }); } // Note: The `page` page parameter only allows pagination within the // 10,000 window available without a page and offset parameter // Error: Result window is too large, PageNo x Offset size must // be less than or equal to 10000 getHistory(addressOrName, startBlock, endBlock) { return etherscan_provider_awaiter(this, void 0, void 0, function* () { const params = { action: "txlist", address: (yield this.resolveName(addressOrName)), startblock: ((startBlock == null) ? 0 : startBlock), endblock: ((endBlock == null) ? 99999999 : endBlock), sort: "asc" }; const result = yield this.fetch("account", params); return result.map((tx) => { ["contractAddress", "to"].forEach(function (key) { if (tx[key] == "") { delete tx[key]; } }); if (tx.creates == null && tx.contractAddress != null) { tx.creates = tx.contractAddress; } const item = this.formatter.transactionResponse(tx); if (tx.timeStamp) { item.timestamp = parseInt(tx.timeStamp); } return item; }); }); } isCommunityResource() { return (this.apiKey === etherscan_provider_defaultApiKey); } } //# sourceMappingURL=etherscan-provider.js.map // EXTERNAL MODULE: ./node_modules/@ethersproject/providers/lib.esm/fallback-provider.js var fallback_provider = __webpack_require__(51619); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/providers/lib.esm/ipc-provider.js const IpcProvider = null; //# sourceMappingURL=ipc-provider.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/providers/lib.esm/infura-provider.js const infura_provider_logger = new logger_lib_esm.Logger(_version/* version */.i); const defaultProjectId = "84842078b09946638c03157f83405213"; class InfuraWebSocketProvider extends websocket_provider/* WebSocketProvider */.q { constructor(network, apiKey) { const provider = new InfuraProvider(network, apiKey); const connection = provider.connection; if (connection.password) { infura_provider_logger.throwError("INFURA WebSocket project secrets unsupported", logger_lib_esm.Logger.errors.UNSUPPORTED_OPERATION, { operation: "InfuraProvider.getWebSocketProvider()" }); } const url = connection.url.replace(/^http/i, "ws").replace("/v3/", "/ws/v3/"); super(url, network); (0,properties_lib_esm.defineReadOnly)(this, "apiKey", provider.projectId); (0,properties_lib_esm.defineReadOnly)(this, "projectId", provider.projectId); (0,properties_lib_esm.defineReadOnly)(this, "projectSecret", provider.projectSecret); } isCommunityResource() { return (this.projectId === defaultProjectId); } } class InfuraProvider extends url_json_rpc_provider/* UrlJsonRpcProvider */.l { static getWebSocketProvider(network, apiKey) { return new InfuraWebSocketProvider(network, apiKey); } static getApiKey(apiKey) { const apiKeyObj = { apiKey: defaultProjectId, projectId: defaultProjectId, projectSecret: null }; if (apiKey == null) { return apiKeyObj; } if (typeof (apiKey) === "string") { apiKeyObj.projectId = apiKey; } else if (apiKey.projectSecret != null) { infura_provider_logger.assertArgument((typeof (apiKey.projectId) === "string"), "projectSecret requires a projectId", "projectId", apiKey.projectId); infura_provider_logger.assertArgument((typeof (apiKey.projectSecret) === "string"), "invalid projectSecret", "projectSecret", "[REDACTED]"); apiKeyObj.projectId = apiKey.projectId; apiKeyObj.projectSecret = apiKey.projectSecret; } else if (apiKey.projectId) { apiKeyObj.projectId = apiKey.projectId; } apiKeyObj.apiKey = apiKeyObj.projectId; return apiKeyObj; } static getUrl(network, apiKey) { let host = null; switch (network ? network.name : "unknown") { case "homestead": host = "mainnet.infura.io"; break; case "ropsten": host = "ropsten.infura.io"; break; case "rinkeby": host = "rinkeby.infura.io"; break; case "kovan": host = "kovan.infura.io"; break; case "goerli": host = "goerli.infura.io"; break; case "matic": host = "polygon-mainnet.infura.io"; break; case "maticmum": host = "polygon-mumbai.infura.io"; break; case "optimism": host = "optimism-mainnet.infura.io"; break; case "optimism-kovan": host = "optimism-kovan.infura.io"; break; case "arbitrum": host = "arbitrum-mainnet.infura.io"; break; case "arbitrum-rinkeby": host = "arbitrum-rinkeby.infura.io"; break; default: infura_provider_logger.throwError("unsupported network", logger_lib_esm.Logger.errors.INVALID_ARGUMENT, { argument: "network", value: network }); } const connection = { allowGzip: true, url: ("https:/" + "/" + host + "/v3/" + apiKey.projectId), throttleCallback: (attempt, url) => { if (apiKey.projectId === defaultProjectId) { (0,formatter/* showThrottleMessage */.vh)(); } return Promise.resolve(true); } }; if (apiKey.projectSecret != null) { connection.user = ""; connection.password = apiKey.projectSecret; } return connection; } isCommunityResource() { return (this.projectId === defaultProjectId); } } //# sourceMappingURL=infura-provider.js.map // EXTERNAL MODULE: ./node_modules/@ethersproject/providers/lib.esm/json-rpc-provider.js var json_rpc_provider = __webpack_require__(82169); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/providers/lib.esm/json-rpc-batch-provider.js // Experimental class JsonRpcBatchProvider extends json_rpc_provider/* JsonRpcProvider */.r { send(method, params) { const request = { method: method, params: params, id: (this._nextId++), jsonrpc: "2.0" }; if (this._pendingBatch == null) { this._pendingBatch = []; } const inflightRequest = { request, resolve: null, reject: null }; const promise = new Promise((resolve, reject) => { inflightRequest.resolve = resolve; inflightRequest.reject = reject; }); this._pendingBatch.push(inflightRequest); if (!this._pendingBatchAggregator) { // Schedule batch for next event loop + short duration this._pendingBatchAggregator = setTimeout(() => { // Get teh current batch and clear it, so new requests // go into the next batch const batch = this._pendingBatch; this._pendingBatch = null; this._pendingBatchAggregator = null; // Get the request as an array of requests const request = batch.map((inflight) => inflight.request); this.emit("debug", { action: "requestBatch", request: (0,properties_lib_esm.deepCopy)(request), provider: this }); return (0,web_lib_esm.fetchJson)(this.connection, JSON.stringify(request)).then((result) => { this.emit("debug", { action: "response", request: request, response: result, provider: this }); // For each result, feed it to the correct Promise, depending // on whether it was a success or error batch.forEach((inflightRequest, index) => { const payload = result[index]; if (payload.error) { const error = new Error(payload.error.message); error.code = payload.error.code; error.data = payload.error.data; inflightRequest.reject(error); } else { inflightRequest.resolve(payload.result); } }); }, (error) => { this.emit("debug", { action: "response", error: error, request: request, provider: this }); batch.forEach((inflightRequest) => { inflightRequest.reject(error); }); }); }, 10); } return promise; } } //# sourceMappingURL=json-rpc-batch-provider.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/providers/lib.esm/nodesmith-provider.js /* istanbul ignore file */ const nodesmith_provider_logger = new logger_lib_esm.Logger(_version/* version */.i); // Special API key provided by Nodesmith for ethers.js const nodesmith_provider_defaultApiKey = "ETHERS_JS_SHARED"; class NodesmithProvider extends url_json_rpc_provider/* UrlJsonRpcProvider */.l { static getApiKey(apiKey) { if (apiKey && typeof (apiKey) !== "string") { nodesmith_provider_logger.throwArgumentError("invalid apiKey", "apiKey", apiKey); } return apiKey || nodesmith_provider_defaultApiKey; } static getUrl(network, apiKey) { nodesmith_provider_logger.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform."); let host = null; switch (network.name) { case "homestead": host = "https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc"; break; case "ropsten": host = "https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc"; break; case "rinkeby": host = "https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc"; break; case "goerli": host = "https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc"; break; case "kovan": host = "https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc"; break; default: nodesmith_provider_logger.throwArgumentError("unsupported network", "network", arguments[0]); } return (host + "?apiKey=" + apiKey); } } //# sourceMappingURL=nodesmith-provider.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/providers/lib.esm/pocket-provider.js const pocket_provider_logger = new logger_lib_esm.Logger(_version/* version */.i); // These are load-balancer-based application IDs const defaultApplicationIds = { homestead: "6004bcd10040261633ade990", ropsten: "6004bd4d0040261633ade991", rinkeby: "6004bda20040261633ade994", goerli: "6004bd860040261633ade992", }; class PocketProvider extends url_json_rpc_provider/* UrlJsonRpcProvider */.l { constructor(network, apiKey) { // We need a bit of creativity in the constructor because // Pocket uses different default API keys based on the network if (apiKey == null) { const n = (0,properties_lib_esm.getStatic)(new.target, "getNetwork")(network); if (n) { const applicationId = defaultApplicationIds[n.name]; if (applicationId) { apiKey = { applicationId: applicationId, loadBalancer: true }; } } // If there was any issue above, we don't know this network if (apiKey == null) { pocket_provider_logger.throwError("unsupported network", logger_lib_esm.Logger.errors.INVALID_ARGUMENT, { argument: "network", value: network }); } } super(network, apiKey); } static getApiKey(apiKey) { // Most API Providers allow null to get the default configuration, but // Pocket requires the network to decide the default provider, so we // rely on hijacking the constructor to add a sensible default for us if (apiKey == null) { pocket_provider_logger.throwArgumentError("PocketProvider.getApiKey does not support null apiKey", "apiKey", apiKey); } const apiKeyObj = { applicationId: null, loadBalancer: false, applicationSecretKey: null }; // Parse applicationId and applicationSecretKey if (typeof (apiKey) === "string") { apiKeyObj.applicationId = apiKey; } else if (apiKey.applicationSecretKey != null) { pocket_provider_logger.assertArgument((typeof (apiKey.applicationId) === "string"), "applicationSecretKey requires an applicationId", "applicationId", apiKey.applicationId); pocket_provider_logger.assertArgument((typeof (apiKey.applicationSecretKey) === "string"), "invalid applicationSecretKey", "applicationSecretKey", "[REDACTED]"); apiKeyObj.applicationId = apiKey.applicationId; apiKeyObj.applicationSecretKey = apiKey.applicationSecretKey; apiKeyObj.loadBalancer = !!apiKey.loadBalancer; } else if (apiKey.applicationId) { pocket_provider_logger.assertArgument((typeof (apiKey.applicationId) === "string"), "apiKey.applicationId must be a string", "apiKey.applicationId", apiKey.applicationId); apiKeyObj.applicationId = apiKey.applicationId; apiKeyObj.loadBalancer = !!apiKey.loadBalancer; } else { pocket_provider_logger.throwArgumentError("unsupported PocketProvider apiKey", "apiKey", apiKey); } return apiKeyObj; } static getUrl(network, apiKey) { let host = null; switch (network ? network.name : "unknown") { case "homestead": host = "eth-mainnet.gateway.pokt.network"; break; case "ropsten": host = "eth-ropsten.gateway.pokt.network"; break; case "rinkeby": host = "eth-rinkeby.gateway.pokt.network"; break; case "goerli": host = "eth-goerli.gateway.pokt.network"; break; default: pocket_provider_logger.throwError("unsupported network", logger_lib_esm.Logger.errors.INVALID_ARGUMENT, { argument: "network", value: network }); } let url = null; if (apiKey.loadBalancer) { url = `https:/\/${host}/v1/lb/${apiKey.applicationId}`; } else { url = `https:/\/${host}/v1/${apiKey.applicationId}`; } const connection = { url }; // Initialize empty headers connection.headers = {}; // Apply application secret key if (apiKey.applicationSecretKey != null) { connection.user = ""; connection.password = apiKey.applicationSecretKey; } return connection; } isCommunityResource() { return (this.applicationId === defaultApplicationIds[this.network.name]); } } //# sourceMappingURL=pocket-provider.js.map // EXTERNAL MODULE: ./node_modules/@ethersproject/providers/lib.esm/web3-provider.js var web3_provider = __webpack_require__(241); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/providers/lib.esm/index.js const lib_esm_logger = new logger_lib_esm.Logger(_version/* version */.i); //////////////////////// // Helper Functions function getDefaultProvider(network, options) { if (network == null) { network = "homestead"; } // If passed a URL, figure out the right type of provider based on the scheme if (typeof (network) === "string") { // @TODO: Add support for IpcProvider; maybe if it ends in ".ipc"? // Handle http and ws (and their secure variants) const match = network.match(/^(ws|http)s?:/i); if (match) { switch (match[1].toLowerCase()) { case "http": case "https": return new json_rpc_provider/* JsonRpcProvider */.r(network); case "ws": case "wss": return new websocket_provider/* WebSocketProvider */.q(network); default: lib_esm_logger.throwArgumentError("unsupported URL scheme", "network", network); } } } const n = (0,networks_lib_esm/* getNetwork */.H)(network); if (!n || !n._defaultProvider) { lib_esm_logger.throwError("unsupported getDefaultProvider network", logger_lib_esm.Logger.errors.NETWORK_ERROR, { operation: "getDefaultProvider", network: network }); } return n._defaultProvider({ FallbackProvider: fallback_provider/* FallbackProvider */.H, AlchemyProvider: AlchemyProvider, AnkrProvider: AnkrProvider, CloudflareProvider: CloudflareProvider, EtherscanProvider: EtherscanProvider, InfuraProvider: InfuraProvider, JsonRpcProvider: json_rpc_provider/* JsonRpcProvider */.r, NodesmithProvider: NodesmithProvider, PocketProvider: PocketProvider, Web3Provider: web3_provider/* Web3Provider */.Q, IpcProvider: IpcProvider, }, options); } //////////////////////// // Exports //# sourceMappingURL=index.js.map /***/ }), /***/ 82169: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "C": function() { return /* binding */ JsonRpcSigner; }, /* harmony export */ "r": function() { return /* binding */ JsonRpcProvider; } /* harmony export */ }); /* harmony import */ var _ethersproject_abstract_signer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(48088); /* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(2593); /* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(16441); /* harmony import */ var _ethersproject_hash__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(67827); /* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6881); /* harmony import */ var _ethersproject_strings__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(29251); /* harmony import */ var _ethersproject_transactions__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(83875); /* harmony import */ var _ethersproject_web__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(37707); /* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1581); /* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(34216); /* harmony import */ var _base_provider__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(75361); var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; const logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__/* .version */ .i); const errorGas = ["call", "estimateGas"]; function spelunk(value, requireData) { if (value == null) { return null; } // These *are* the droids we're looking for. if (typeof (value.message) === "string" && value.message.match("reverted")) { const data = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.isHexString)(value.data) ? value.data : null; if (!requireData || data) { return { message: value.message, data }; } } // Spelunk further... if (typeof (value) === "object") { for (const key in value) { const result = spelunk(value[key], requireData); if (result) { return result; } } return null; } // Might be a JSON string we can further descend... if (typeof (value) === "string") { try { return spelunk(JSON.parse(value), requireData); } catch (error) { } } return null; } function checkError(method, error, params) { const transaction = params.transaction || params.signedTransaction; // Undo the "convenience" some nodes are attempting to prevent backwards // incompatibility; maybe for v6 consider forwarding reverts as errors if (method === "call") { const result = spelunk(error, true); if (result) { return result.data; } // Nothing descriptive.. logger.throwError("missing revert data in call exception; Transaction reverted without a reason string", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.CALL_EXCEPTION, { data: "0x", transaction, error }); } if (method === "estimateGas") { // Try to find something, with a preference on SERVER_ERROR body let result = spelunk(error.body, false); if (result == null) { result = spelunk(error, false); } // Found "reverted", this is a CALL_EXCEPTION if (result) { logger.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.UNPREDICTABLE_GAS_LIMIT, { reason: result.message, method, transaction, error }); } } // @TODO: Should we spelunk for message too? let message = error.message; if (error.code === _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.SERVER_ERROR && error.error && typeof (error.error.message) === "string") { message = error.error.message; } else if (typeof (error.body) === "string") { message = error.body; } else if (typeof (error.responseText) === "string") { message = error.responseText; } message = (message || "").toLowerCase(); // "insufficient funds for gas * price + value + cost(data)" if (message.match(/insufficient funds|base fee exceeds gas limit/i)) { logger.throwError("insufficient funds for intrinsic transaction cost", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.INSUFFICIENT_FUNDS, { error, method, transaction }); } // "nonce too low" if (message.match(/nonce (is )?too low/i)) { logger.throwError("nonce has already been used", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.NONCE_EXPIRED, { error, method, transaction }); } // "replacement transaction underpriced" if (message.match(/replacement transaction underpriced|transaction gas price.*too low/i)) { logger.throwError("replacement fee too low", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.REPLACEMENT_UNDERPRICED, { error, method, transaction }); } // "replacement transaction underpriced" if (message.match(/only replay-protected/i)) { logger.throwError("legacy pre-eip-155 transactions not supported", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.UNSUPPORTED_OPERATION, { error, method, transaction }); } if (errorGas.indexOf(method) >= 0 && message.match(/gas required exceeds allowance|always failing transaction|execution reverted/)) { logger.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.UNPREDICTABLE_GAS_LIMIT, { error, method, transaction }); } throw error; } function timer(timeout) { return new Promise(function (resolve) { setTimeout(resolve, timeout); }); } function getResult(payload) { if (payload.error) { // @TODO: not any const error = new Error(payload.error.message); error.code = payload.error.code; error.data = payload.error.data; throw error; } return payload.result; } function getLowerCase(value) { if (value) { return value.toLowerCase(); } return value; } const _constructorGuard = {}; class JsonRpcSigner extends _ethersproject_abstract_signer__WEBPACK_IMPORTED_MODULE_3__.Signer { constructor(constructorGuard, provider, addressOrIndex) { super(); if (constructorGuard !== _constructorGuard) { throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner"); } (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__.defineReadOnly)(this, "provider", provider); if (addressOrIndex == null) { addressOrIndex = 0; } if (typeof (addressOrIndex) === "string") { (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__.defineReadOnly)(this, "_address", this.provider.formatter.address(addressOrIndex)); (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__.defineReadOnly)(this, "_index", null); } else if (typeof (addressOrIndex) === "number") { (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__.defineReadOnly)(this, "_index", addressOrIndex); (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__.defineReadOnly)(this, "_address", null); } else { logger.throwArgumentError("invalid address or index", "addressOrIndex", addressOrIndex); } } connect(provider) { return logger.throwError("cannot alter JSON-RPC Signer connection", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.UNSUPPORTED_OPERATION, { operation: "connect" }); } connectUnchecked() { return new UncheckedJsonRpcSigner(_constructorGuard, this.provider, this._address || this._index); } getAddress() { if (this._address) { return Promise.resolve(this._address); } return this.provider.send("eth_accounts", []).then((accounts) => { if (accounts.length <= this._index) { logger.throwError("unknown account #" + this._index, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.UNSUPPORTED_OPERATION, { operation: "getAddress" }); } return this.provider.formatter.address(accounts[this._index]); }); } sendUncheckedTransaction(transaction) { transaction = (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__.shallowCopy)(transaction); const fromAddress = this.getAddress().then((address) => { if (address) { address = address.toLowerCase(); } return address; }); // The JSON-RPC for eth_sendTransaction uses 90000 gas; if the user // wishes to use this, it is easy to specify explicitly, otherwise // we look it up for them. if (transaction.gasLimit == null) { const estimate = (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__.shallowCopy)(transaction); estimate.from = fromAddress; transaction.gasLimit = this.provider.estimateGas(estimate); } if (transaction.to != null) { transaction.to = Promise.resolve(transaction.to).then((to) => __awaiter(this, void 0, void 0, function* () { if (to == null) { return null; } const address = yield this.provider.resolveName(to); if (address == null) { logger.throwArgumentError("provided ENS name resolves to null", "tx.to", to); } return address; })); } return (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__.resolveProperties)({ tx: (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__.resolveProperties)(transaction), sender: fromAddress }).then(({ tx, sender }) => { if (tx.from != null) { if (tx.from.toLowerCase() !== sender) { logger.throwArgumentError("from address mismatch", "transaction", transaction); } } else { tx.from = sender; } const hexTx = this.provider.constructor.hexlifyTransaction(tx, { from: true }); return this.provider.send("eth_sendTransaction", [hexTx]).then((hash) => { return hash; }, (error) => { return checkError("sendTransaction", error, hexTx); }); }); } signTransaction(transaction) { return logger.throwError("signing transactions is unsupported", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.UNSUPPORTED_OPERATION, { operation: "signTransaction" }); } sendTransaction(transaction) { return __awaiter(this, void 0, void 0, function* () { // This cannot be mined any earlier than any recent block const blockNumber = yield this.provider._getInternalBlockNumber(100 + 2 * this.provider.pollingInterval); // Send the transaction const hash = yield this.sendUncheckedTransaction(transaction); try { // Unfortunately, JSON-RPC only provides and opaque transaction hash // for a response, and we need the actual transaction, so we poll // for it; it should show up very quickly return yield (0,_ethersproject_web__WEBPACK_IMPORTED_MODULE_5__.poll)(() => __awaiter(this, void 0, void 0, function* () { const tx = yield this.provider.getTransaction(hash); if (tx === null) { return undefined; } return this.provider._wrapTransaction(tx, hash, blockNumber); }), { oncePoll: this.provider }); } catch (error) { error.transactionHash = hash; throw error; } }); } signMessage(message) { return __awaiter(this, void 0, void 0, function* () { const data = ((typeof (message) === "string") ? (0,_ethersproject_strings__WEBPACK_IMPORTED_MODULE_6__/* .toUtf8Bytes */ .Y0)(message) : message); const address = yield this.getAddress(); return yield this.provider.send("personal_sign", [(0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexlify)(data), address.toLowerCase()]); }); } _legacySignMessage(message) { return __awaiter(this, void 0, void 0, function* () { const data = ((typeof (message) === "string") ? (0,_ethersproject_strings__WEBPACK_IMPORTED_MODULE_6__/* .toUtf8Bytes */ .Y0)(message) : message); const address = yield this.getAddress(); // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign return yield this.provider.send("eth_sign", [address.toLowerCase(), (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexlify)(data)]); }); } _signTypedData(domain, types, value) { return __awaiter(this, void 0, void 0, function* () { // Populate any ENS names (in-place) const populated = yield _ethersproject_hash__WEBPACK_IMPORTED_MODULE_7__/* .TypedDataEncoder.resolveNames */ .E.resolveNames(domain, types, value, (name) => { return this.provider.resolveName(name); }); const address = yield this.getAddress(); return yield this.provider.send("eth_signTypedData_v4", [ address.toLowerCase(), JSON.stringify(_ethersproject_hash__WEBPACK_IMPORTED_MODULE_7__/* .TypedDataEncoder.getPayload */ .E.getPayload(populated.domain, types, populated.value)) ]); }); } unlock(password) { return __awaiter(this, void 0, void 0, function* () { const provider = this.provider; const address = yield this.getAddress(); return provider.send("personal_unlockAccount", [address.toLowerCase(), password, null]); }); } } class UncheckedJsonRpcSigner extends JsonRpcSigner { sendTransaction(transaction) { return this.sendUncheckedTransaction(transaction).then((hash) => { return { hash: hash, nonce: null, gasLimit: null, gasPrice: null, data: null, value: null, chainId: null, confirmations: 0, from: null, wait: (confirmations) => { return this.provider.waitForTransaction(hash, confirmations); } }; }); } } const allowedTransactionKeys = { chainId: true, data: true, gasLimit: true, gasPrice: true, nonce: true, to: true, value: true, type: true, accessList: true, maxFeePerGas: true, maxPriorityFeePerGas: true }; class JsonRpcProvider extends _base_provider__WEBPACK_IMPORTED_MODULE_8__/* .BaseProvider */ .Zk { constructor(url, network) { let networkOrReady = network; // The network is unknown, query the JSON-RPC for it if (networkOrReady == null) { networkOrReady = new Promise((resolve, reject) => { setTimeout(() => { this.detectNetwork().then((network) => { resolve(network); }, (error) => { reject(error); }); }, 0); }); } super(networkOrReady); // Default URL if (!url) { url = (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__.getStatic)(this.constructor, "defaultUrl")(); } if (typeof (url) === "string") { (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__.defineReadOnly)(this, "connection", Object.freeze({ url: url })); } else { (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__.defineReadOnly)(this, "connection", Object.freeze((0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__.shallowCopy)(url))); } this._nextId = 42; } get _cache() { if (this._eventLoopCache == null) { this._eventLoopCache = {}; } return this._eventLoopCache; } static defaultUrl() { return "http:/\/localhost:8545"; } detectNetwork() { if (!this._cache["detectNetwork"]) { this._cache["detectNetwork"] = this._uncachedDetectNetwork(); // Clear this cache at the beginning of the next event loop setTimeout(() => { this._cache["detectNetwork"] = null; }, 0); } return this._cache["detectNetwork"]; } _uncachedDetectNetwork() { return __awaiter(this, void 0, void 0, function* () { yield timer(0); let chainId = null; try { chainId = yield this.send("eth_chainId", []); } catch (error) { try { chainId = yield this.send("net_version", []); } catch (error) { } } if (chainId != null) { const getNetwork = (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__.getStatic)(this.constructor, "getNetwork"); try { return getNetwork(_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_9__/* .BigNumber.from */ .O$.from(chainId).toNumber()); } catch (error) { return logger.throwError("could not detect network", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.NETWORK_ERROR, { chainId: chainId, event: "invalidNetwork", serverError: error }); } } return logger.throwError("could not detect network", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.NETWORK_ERROR, { event: "noNetwork" }); }); } getSigner(addressOrIndex) { return new JsonRpcSigner(_constructorGuard, this, addressOrIndex); } getUncheckedSigner(addressOrIndex) { return this.getSigner(addressOrIndex).connectUnchecked(); } listAccounts() { return this.send("eth_accounts", []).then((accounts) => { return accounts.map((a) => this.formatter.address(a)); }); } send(method, params) { const request = { method: method, params: params, id: (this._nextId++), jsonrpc: "2.0" }; this.emit("debug", { action: "request", request: (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__.deepCopy)(request), provider: this }); // We can expand this in the future to any call, but for now these // are the biggest wins and do not require any serializing parameters. const cache = (["eth_chainId", "eth_blockNumber"].indexOf(method) >= 0); if (cache && this._cache[method]) { return this._cache[method]; } const result = (0,_ethersproject_web__WEBPACK_IMPORTED_MODULE_5__.fetchJson)(this.connection, JSON.stringify(request), getResult).then((result) => { this.emit("debug", { action: "response", request: request, response: result, provider: this }); return result; }, (error) => { this.emit("debug", { action: "response", error: error, request: request, provider: this }); throw error; }); // Cache the fetch, but clear it on the next event loop if (cache) { this._cache[method] = result; setTimeout(() => { this._cache[method] = null; }, 0); } return result; } prepareRequest(method, params) { switch (method) { case "getBlockNumber": return ["eth_blockNumber", []]; case "getGasPrice": return ["eth_gasPrice", []]; case "getBalance": return ["eth_getBalance", [getLowerCase(params.address), params.blockTag]]; case "getTransactionCount": return ["eth_getTransactionCount", [getLowerCase(params.address), params.blockTag]]; case "getCode": return ["eth_getCode", [getLowerCase(params.address), params.blockTag]]; case "getStorageAt": return ["eth_getStorageAt", [getLowerCase(params.address), (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexZeroPad)(params.position, 32), params.blockTag]]; case "sendTransaction": return ["eth_sendRawTransaction", [params.signedTransaction]]; case "getBlock": if (params.blockTag) { return ["eth_getBlockByNumber", [params.blockTag, !!params.includeTransactions]]; } else if (params.blockHash) { return ["eth_getBlockByHash", [params.blockHash, !!params.includeTransactions]]; } return null; case "getTransaction": return ["eth_getTransactionByHash", [params.transactionHash]]; case "getTransactionReceipt": return ["eth_getTransactionReceipt", [params.transactionHash]]; case "call": { const hexlifyTransaction = (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__.getStatic)(this.constructor, "hexlifyTransaction"); return ["eth_call", [hexlifyTransaction(params.transaction, { from: true }), params.blockTag]]; } case "estimateGas": { const hexlifyTransaction = (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__.getStatic)(this.constructor, "hexlifyTransaction"); return ["eth_estimateGas", [hexlifyTransaction(params.transaction, { from: true })]]; } case "getLogs": if (params.filter && params.filter.address != null) { params.filter.address = getLowerCase(params.filter.address); } return ["eth_getLogs", [params.filter]]; default: break; } return null; } perform(method, params) { return __awaiter(this, void 0, void 0, function* () { // Legacy networks do not like the type field being passed along (which // is fair), so we delete type if it is 0 and a non-EIP-1559 network if (method === "call" || method === "estimateGas") { const tx = params.transaction; if (tx && tx.type != null && _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_9__/* .BigNumber.from */ .O$.from(tx.type).isZero()) { // If there are no EIP-1559 properties, it might be non-EIP-1559 if (tx.maxFeePerGas == null && tx.maxPriorityFeePerGas == null) { const feeData = yield this.getFeeData(); if (feeData.maxFeePerGas == null && feeData.maxPriorityFeePerGas == null) { // Network doesn't know about EIP-1559 (and hence type) params = (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__.shallowCopy)(params); params.transaction = (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__.shallowCopy)(tx); delete params.transaction.type; } } } } const args = this.prepareRequest(method, params); if (args == null) { logger.throwError(method + " not implemented", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.NOT_IMPLEMENTED, { operation: method }); } try { return yield this.send(args[0], args[1]); } catch (error) { return checkError(method, error, params); } }); } _startEvent(event) { if (event.tag === "pending") { this._startPending(); } super._startEvent(event); } _startPending() { if (this._pendingFilter != null) { return; } const self = this; const pendingFilter = this.send("eth_newPendingTransactionFilter", []); this._pendingFilter = pendingFilter; pendingFilter.then(function (filterId) { function poll() { self.send("eth_getFilterChanges", [filterId]).then(function (hashes) { if (self._pendingFilter != pendingFilter) { return null; } let seq = Promise.resolve(); hashes.forEach(function (hash) { // @TODO: This should be garbage collected at some point... How? When? self._emitted["t:" + hash.toLowerCase()] = "pending"; seq = seq.then(function () { return self.getTransaction(hash).then(function (tx) { self.emit("pending", tx); return null; }); }); }); return seq.then(function () { return timer(1000); }); }).then(function () { if (self._pendingFilter != pendingFilter) { self.send("eth_uninstallFilter", [filterId]); return; } setTimeout(function () { poll(); }, 0); return null; }).catch((error) => { }); } poll(); return filterId; }).catch((error) => { }); } _stopEvent(event) { if (event.tag === "pending" && this.listenerCount("pending") === 0) { this._pendingFilter = null; } super._stopEvent(event); } // Convert an ethers.js transaction into a JSON-RPC transaction // - gasLimit => gas // - All values hexlified // - All numeric values zero-striped // - All addresses are lowercased // NOTE: This allows a TransactionRequest, but all values should be resolved // before this is called // @TODO: This will likely be removed in future versions and prepareRequest // will be the preferred method for this. static hexlifyTransaction(transaction, allowExtra) { // Check only allowed properties are given const allowed = (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__.shallowCopy)(allowedTransactionKeys); if (allowExtra) { for (const key in allowExtra) { if (allowExtra[key]) { allowed[key] = true; } } } (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__.checkProperties)(transaction, allowed); const result = {}; // JSON-RPC now requires numeric values to be "quantity" values ["chainId", "gasLimit", "gasPrice", "type", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "value"].forEach(function (key) { if (transaction[key] == null) { return; } const value = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexValue)(_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_9__/* .BigNumber.from */ .O$.from(transaction[key])); if (key === "gasLimit") { key = "gas"; } result[key] = value; }); ["from", "to", "data"].forEach(function (key) { if (transaction[key] == null) { return; } result[key] = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__.hexlify)(transaction[key]); }); if (transaction.accessList) { result["accessList"] = (0,_ethersproject_transactions__WEBPACK_IMPORTED_MODULE_10__.accessListify)(transaction.accessList); } return result; } } //# sourceMappingURL=json-rpc-provider.js.map /***/ }), /***/ 93901: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "c": function() { return /* binding */ StaticJsonRpcProvider; }, /* harmony export */ "l": function() { return /* binding */ UrlJsonRpcProvider; } /* harmony export */ }); /* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6881); /* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1581); /* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(34216); /* harmony import */ var _json_rpc_provider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(82169); var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; const logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__/* .version */ .i); // A StaticJsonRpcProvider is useful when you *know* for certain that // the backend will never change, as it never calls eth_chainId to // verify its backend. However, if the backend does change, the effects // are undefined and may include: // - inconsistent results // - locking up the UI // - block skew warnings // - wrong results // If the network is not explicit (i.e. auto-detection is expected), the // node MUST be running and available to respond to requests BEFORE this // is instantiated. class StaticJsonRpcProvider extends _json_rpc_provider__WEBPACK_IMPORTED_MODULE_2__/* .JsonRpcProvider */ .r { detectNetwork() { const _super = Object.create(null, { detectNetwork: { get: () => super.detectNetwork } }); return __awaiter(this, void 0, void 0, function* () { let network = this.network; if (network == null) { network = yield _super.detectNetwork.call(this); if (!network) { logger.throwError("no network detected", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.UNKNOWN_ERROR, {}); } // If still not set, set it if (this._network == null) { // A static network does not support "any" (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.defineReadOnly)(this, "_network", network); this.emit("network", network, null); } } return network; }); } } class UrlJsonRpcProvider extends StaticJsonRpcProvider { constructor(network, apiKey) { logger.checkAbstract(new.target, UrlJsonRpcProvider); // Normalize the Network and API Key network = (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.getStatic)(new.target, "getNetwork")(network); apiKey = (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.getStatic)(new.target, "getApiKey")(apiKey); const connection = (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.getStatic)(new.target, "getUrl")(network, apiKey); super(connection, network); if (typeof (apiKey) === "string") { (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.defineReadOnly)(this, "apiKey", apiKey); } else if (apiKey != null) { Object.keys(apiKey).forEach((key) => { (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__.defineReadOnly)(this, key, apiKey[key]); }); } } _startPending() { logger.warn("WARNING: API provider does not support pending filters"); } isCommunityResource() { return false; } getSigner(address) { return logger.throwError("API provider does not support signing", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.UNSUPPORTED_OPERATION, { operation: "getSigner" }); } listAccounts() { return Promise.resolve([]); } // Return a defaultApiKey if null, otherwise validate the API key static getApiKey(apiKey) { return apiKey; } // Returns the url or connection for the given network and API key. The // API key will have been sanitized by the getApiKey first, so any validation // or transformations can be done there. static getUrl(network, apiKey) { return logger.throwError("not implemented; sub-classes must override getUrl", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger.errors.NOT_IMPLEMENTED, { operation: "getUrl" }); } } //# sourceMappingURL=url-json-rpc-provider.js.map /***/ }), /***/ 241: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Q": function() { return /* binding */ Web3Provider; } /* harmony export */ }); /* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6881); /* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1581); /* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(34216); /* harmony import */ var _json_rpc_provider__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(82169); const logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__.Logger(_version__WEBPACK_IMPORTED_MODULE_1__/* .version */ .i); let _nextId = 1; function buildWeb3LegacyFetcher(provider, sendFunc) { const fetcher = "Web3LegacyFetcher"; return function (method, params) { const request = { method: method, params: params, id: (_nextId++), jsonrpc: "2.0" }; return new Promise((resolve, reject) => { this.emit("debug", { action: "request", fetcher, request: (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.deepCopy)(request), provider: this }); sendFunc(request, (error, response) => { if (error) { this.emit("debug", { action: "response", fetcher, error, request, provider: this }); return reject(error); } this.emit("debug", { action: "response", fetcher, request, response, provider: this }); if (response.error) { const error = new Error(response.error.message); error.code = response.error.code; error.data = response.error.data; return reject(error); } resolve(response.result); }); }); }; } function buildEip1193Fetcher(provider) { return function (method, params) { if (params == null) { params = []; } const request = { method, params }; this.emit("debug", { action: "request", fetcher: "Eip1193Fetcher", request: (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.deepCopy)(request), provider: this }); return provider.request(request).then((response) => { this.emit("debug", { action: "response", fetcher: "Eip1193Fetcher", request, response, provider: this }); return response; }, (error) => { this.emit("debug", { action: "response", fetcher: "Eip1193Fetcher", request, error, provider: this }); throw error; }); }; } class Web3Provider extends _json_rpc_provider__WEBPACK_IMPORTED_MODULE_3__/* .JsonRpcProvider */ .r { constructor(provider, network) { if (provider == null) { logger.throwArgumentError("missing provider", "provider", provider); } let path = null; let jsonRpcFetchFunc = null; let subprovider = null; if (typeof (provider) === "function") { path = "unknown:"; jsonRpcFetchFunc = provider; } else { path = provider.host || provider.path || ""; if (!path && provider.isMetaMask) { path = "metamask"; } subprovider = provider; if (provider.request) { if (path === "") { path = "eip-1193:"; } jsonRpcFetchFunc = buildEip1193Fetcher(provider); } else if (provider.sendAsync) { jsonRpcFetchFunc = buildWeb3LegacyFetcher(provider, provider.sendAsync.bind(provider)); } else if (provider.send) { jsonRpcFetchFunc = buildWeb3LegacyFetcher(provider, provider.send.bind(provider)); } else { logger.throwArgumentError("unsupported provider", "provider", provider); } if (!path) { path = "unknown:"; } } super(path, network); (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.defineReadOnly)(this, "jsonRpcFetchFunc", jsonRpcFetchFunc); (0,_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__.defineReadOnly)(this, "provider", subprovider); } send(method, params) { return this.jsonRpcFetchFunc(method, params); } } //# sourceMappingURL=web3-provider.js.map /***/ }), /***/ 88089: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { "q": function() { return /* binding */ WebSocketProvider; } }); // EXTERNAL MODULE: ./node_modules/@ethersproject/bignumber/lib.esm/bignumber.js var bignumber = __webpack_require__(2593); // EXTERNAL MODULE: ./node_modules/@ethersproject/properties/lib.esm/index.js + 1 modules var lib_esm = __webpack_require__(6881); // EXTERNAL MODULE: ./node_modules/@ethersproject/providers/lib.esm/json-rpc-provider.js var json_rpc_provider = __webpack_require__(82169); // EXTERNAL MODULE: ./node_modules/@ethersproject/logger/lib.esm/index.js + 1 modules var logger_lib_esm = __webpack_require__(1581); // EXTERNAL MODULE: ./node_modules/@ethersproject/providers/lib.esm/_version.js var _version = __webpack_require__(34216); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/providers/lib.esm/ws.js let WS = null; try { WS = WebSocket; if (WS == null) { throw new Error("inject please"); } } catch (error) { const logger = new logger_lib_esm.Logger(_version/* version */.i); WS = function () { logger.throwError("WebSockets not supported in this environment", logger_lib_esm.Logger.errors.UNSUPPORTED_OPERATION, { operation: "new WebSocket()" }); }; } //export default WS; //module.exports = WS; //# sourceMappingURL=ws.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/providers/lib.esm/websocket-provider.js var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; const logger = new logger_lib_esm.Logger(_version/* version */.i); /** * Notes: * * This provider differs a bit from the polling providers. One main * difference is how it handles consistency. The polling providers * will stall responses to ensure a consistent state, while this * WebSocket provider assumes the connected backend will manage this. * * For example, if a polling provider emits an event which indicates * the event occurred in blockhash XXX, a call to fetch that block by * its hash XXX, if not present will retry until it is present. This * can occur when querying a pool of nodes that are mildly out of sync * with each other. */ let NextId = 1; // For more info about the Real-time Event API see: // https://geth.ethereum.org/docs/rpc/pubsub class WebSocketProvider extends json_rpc_provider/* JsonRpcProvider */.r { constructor(url, network) { // This will be added in the future; please open an issue to expedite if (network === "any") { logger.throwError("WebSocketProvider does not support 'any' network yet", logger_lib_esm.Logger.errors.UNSUPPORTED_OPERATION, { operation: "network:any" }); } if (typeof (url) === "string") { super(url, network); } else { super("_websocket", network); } this._pollingInterval = -1; this._wsReady = false; if (typeof (url) === "string") { (0,lib_esm.defineReadOnly)(this, "_websocket", new WS(this.connection.url)); } else { (0,lib_esm.defineReadOnly)(this, "_websocket", url); } (0,lib_esm.defineReadOnly)(this, "_requests", {}); (0,lib_esm.defineReadOnly)(this, "_subs", {}); (0,lib_esm.defineReadOnly)(this, "_subIds", {}); (0,lib_esm.defineReadOnly)(this, "_detectNetwork", super.detectNetwork()); // Stall sending requests until the socket is open... this.websocket.onopen = () => { this._wsReady = true; Object.keys(this._requests).forEach((id) => { this.websocket.send(this._requests[id].payload); }); }; this.websocket.onmessage = (messageEvent) => { const data = messageEvent.data; const result = JSON.parse(data); if (result.id != null) { const id = String(result.id); const request = this._requests[id]; delete this._requests[id]; if (result.result !== undefined) { request.callback(null, result.result); this.emit("debug", { action: "response", request: JSON.parse(request.payload), response: result.result, provider: this }); } else { let error = null; if (result.error) { error = new Error(result.error.message || "unknown error"); (0,lib_esm.defineReadOnly)(error, "code", result.error.code || null); (0,lib_esm.defineReadOnly)(error, "response", data); } else { error = new Error("unknown error"); } request.callback(error, undefined); this.emit("debug", { action: "response", error: error, request: JSON.parse(request.payload), provider: this }); } } else if (result.method === "eth_subscription") { // Subscription... const sub = this._subs[result.params.subscription]; if (sub) { //this.emit.apply(this, ); sub.processFunc(result.params.result); } } else { console.warn("this should not happen"); } }; // This Provider does not actually poll, but we want to trigger // poll events for things that depend on them (like stalling for // block and transaction lookups) const fauxPoll = setInterval(() => { this.emit("poll"); }, 1000); if (fauxPoll.unref) { fauxPoll.unref(); } } // Cannot narrow the type of _websocket, as that is not backwards compatible // so we add a getter and let the WebSocket be a public API. get websocket() { return this._websocket; } detectNetwork() { return this._detectNetwork; } get pollingInterval() { return 0; } resetEventsBlock(blockNumber) { logger.throwError("cannot reset events block on WebSocketProvider", logger_lib_esm.Logger.errors.UNSUPPORTED_OPERATION, { operation: "resetEventBlock" }); } set pollingInterval(value) { logger.throwError("cannot set polling interval on WebSocketProvider", logger_lib_esm.Logger.errors.UNSUPPORTED_OPERATION, { operation: "setPollingInterval" }); } poll() { return __awaiter(this, void 0, void 0, function* () { return null; }); } set polling(value) { if (!value) { return; } logger.throwError("cannot set polling on WebSocketProvider", logger_lib_esm.Logger.errors.UNSUPPORTED_OPERATION, { operation: "setPolling" }); } send(method, params) { const rid = NextId++; return new Promise((resolve, reject) => { function callback(error, result) { if (error) { return reject(error); } return resolve(result); } const payload = JSON.stringify({ method: method, params: params, id: rid, jsonrpc: "2.0" }); this.emit("debug", { action: "request", request: JSON.parse(payload), provider: this }); this._requests[String(rid)] = { callback, payload }; if (this._wsReady) { this.websocket.send(payload); } }); } static defaultUrl() { return "ws:/\/localhost:8546"; } _subscribe(tag, param, processFunc) { return __awaiter(this, void 0, void 0, function* () { let subIdPromise = this._subIds[tag]; if (subIdPromise == null) { subIdPromise = Promise.all(param).then((param) => { return this.send("eth_subscribe", param); }); this._subIds[tag] = subIdPromise; } const subId = yield subIdPromise; this._subs[subId] = { tag, processFunc }; }); } _startEvent(event) { switch (event.type) { case "block": this._subscribe("block", ["newHeads"], (result) => { const blockNumber = bignumber/* BigNumber.from */.O$.from(result.number).toNumber(); this._emitted.block = blockNumber; this.emit("block", blockNumber); }); break; case "pending": this._subscribe("pending", ["newPendingTransactions"], (result) => { this.emit("pending", result); }); break; case "filter": this._subscribe(event.tag, ["logs", this._getFilter(event.filter)], (result) => { if (result.removed == null) { result.removed = false; } this.emit(event.filter, this.formatter.filterLog(result)); }); break; case "tx": { const emitReceipt = (event) => { const hash = event.hash; this.getTransactionReceipt(hash).then((receipt) => { if (!receipt) { return; } this.emit(hash, receipt); }); }; // In case it is already mined emitReceipt(event); // To keep things simple, we start up a single newHeads subscription // to keep an eye out for transactions we are watching for. // Starting a subscription for an event (i.e. "tx") that is already // running is (basically) a nop. this._subscribe("tx", ["newHeads"], (result) => { this._events.filter((e) => (e.type === "tx")).forEach(emitReceipt); }); break; } // Nothing is needed case "debug": case "poll": case "willPoll": case "didPoll": case "error": break; default: console.log("unhandled:", event); break; } } _stopEvent(event) { let tag = event.tag; if (event.type === "tx") { // There are remaining transaction event listeners if (this._events.filter((e) => (e.type === "tx")).length) { return; } tag = "tx"; } else if (this.listenerCount(event.event)) { // There are remaining event listeners return; } const subId = this._subIds[tag]; if (!subId) { return; } delete this._subIds[tag]; subId.then((subId) => { if (!this._subs[subId]) { return; } delete this._subs[subId]; this.send("eth_unsubscribe", [subId]); }); } destroy() { return __awaiter(this, void 0, void 0, function* () { // Wait until we have connected before trying to disconnect if (this.websocket.readyState === WS.CONNECTING) { yield (new Promise((resolve) => { this.websocket.onopen = function () { resolve(true); }; this.websocket.onerror = function () { resolve(false); }; })); } // Hangup // See: https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent#Status_codes this.websocket.close(1000); }); } } //# sourceMappingURL=websocket-provider.js.map /***/ }), /***/ 22118: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "randomBytes": function() { return /* reexport safe */ _random__WEBPACK_IMPORTED_MODULE_0__.O; }, /* harmony export */ "shuffled": function() { return /* reexport safe */ _shuffle__WEBPACK_IMPORTED_MODULE_1__.y; } /* harmony export */ }); /* harmony import */ var _random__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5634); /* harmony import */ var _shuffle__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(52472); //# sourceMappingURL=index.js.map /***/ }), /***/ 5634: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { "O": function() { return /* binding */ randomBytes; } }); // EXTERNAL MODULE: ./node_modules/@ethersproject/bytes/lib.esm/index.js + 1 modules var lib_esm = __webpack_require__(16441); // EXTERNAL MODULE: ./node_modules/@ethersproject/logger/lib.esm/index.js + 1 modules var logger_lib_esm = __webpack_require__(1581); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/random/lib.esm/_version.js const version = "random/5.6.1"; //# sourceMappingURL=_version.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/random/lib.esm/random.js const logger = new logger_lib_esm.Logger(version); // Debugging line for testing browser lib in node //const window = { crypto: { getRandomValues: () => { } } }; // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis function getGlobal() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof __webpack_require__.g !== 'undefined') { return __webpack_require__.g; } throw new Error('unable to locate global object'); } ; const anyGlobal = getGlobal(); let random_crypto = anyGlobal.crypto || anyGlobal.msCrypto; if (!random_crypto || !random_crypto.getRandomValues) { logger.warn("WARNING: Missing strong random number source"); random_crypto = { getRandomValues: function (buffer) { return logger.throwError("no secure random source avaialble", logger_lib_esm.Logger.errors.UNSUPPORTED_OPERATION, { operation: "crypto.getRandomValues" }); } }; } function randomBytes(length) { if (length <= 0 || length > 1024 || (length % 1) || length != length) { logger.throwArgumentError("invalid length", "length", length); } const result = new Uint8Array(length); random_crypto.getRandomValues(result); return (0,lib_esm.arrayify)(result); } ; //# sourceMappingURL=random.js.map /***/ }), /***/ 52472: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "y": function() { return /* binding */ shuffled; } /* harmony export */ }); function shuffled(array) { array = array.slice(); for (let i = array.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * (i + 1)); const tmp = array[i]; array[i] = array[j]; array[j] = tmp; } return array; } //# sourceMappingURL=shuffle.js.map /***/ }), /***/ 59052: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { "decode": function() { return /* binding */ decode; }, "encode": function() { return /* binding */ encode; } }); // EXTERNAL MODULE: ./node_modules/@ethersproject/bytes/lib.esm/index.js + 1 modules var lib_esm = __webpack_require__(16441); // EXTERNAL MODULE: ./node_modules/@ethersproject/logger/lib.esm/index.js + 1 modules var logger_lib_esm = __webpack_require__(1581); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/rlp/lib.esm/_version.js const version = "rlp/5.6.1"; //# sourceMappingURL=_version.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/rlp/lib.esm/index.js //See: https://github.com/ethereum/wiki/wiki/RLP const logger = new logger_lib_esm.Logger(version); function arrayifyInteger(value) { const result = []; while (value) { result.unshift(value & 0xff); value >>= 8; } return result; } function unarrayifyInteger(data, offset, length) { let result = 0; for (let i = 0; i < length; i++) { result = (result * 256) + data[offset + i]; } return result; } function _encode(object) { if (Array.isArray(object)) { let payload = []; object.forEach(function (child) { payload = payload.concat(_encode(child)); }); if (payload.length <= 55) { payload.unshift(0xc0 + payload.length); return payload; } const length = arrayifyInteger(payload.length); length.unshift(0xf7 + length.length); return length.concat(payload); } if (!(0,lib_esm.isBytesLike)(object)) { logger.throwArgumentError("RLP object must be BytesLike", "object", object); } const data = Array.prototype.slice.call((0,lib_esm.arrayify)(object)); if (data.length === 1 && data[0] <= 0x7f) { return data; } else if (data.length <= 55) { data.unshift(0x80 + data.length); return data; } const length = arrayifyInteger(data.length); length.unshift(0xb7 + length.length); return length.concat(data); } function encode(object) { return (0,lib_esm.hexlify)(_encode(object)); } function _decodeChildren(data, offset, childOffset, length) { const result = []; while (childOffset < offset + 1 + length) { const decoded = _decode(data, childOffset); result.push(decoded.result); childOffset += decoded.consumed; if (childOffset > offset + 1 + length) { logger.throwError("child data too short", logger_lib_esm.Logger.errors.BUFFER_OVERRUN, {}); } } return { consumed: (1 + length), result: result }; } // returns { consumed: number, result: Object } function _decode(data, offset) { if (data.length === 0) { logger.throwError("data too short", logger_lib_esm.Logger.errors.BUFFER_OVERRUN, {}); } // Array with extra length prefix if (data[offset] >= 0xf8) { const lengthLength = data[offset] - 0xf7; if (offset + 1 + lengthLength > data.length) { logger.throwError("data short segment too short", logger_lib_esm.Logger.errors.BUFFER_OVERRUN, {}); } const length = unarrayifyInteger(data, offset + 1, lengthLength); if (offset + 1 + lengthLength + length > data.length) { logger.throwError("data long segment too short", logger_lib_esm.Logger.errors.BUFFER_OVERRUN, {}); } return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length); } else if (data[offset] >= 0xc0) { const length = data[offset] - 0xc0; if (offset + 1 + length > data.length) { logger.throwError("data array too short", logger_lib_esm.Logger.errors.BUFFER_OVERRUN, {}); } return _decodeChildren(data, offset, offset + 1, length); } else if (data[offset] >= 0xb8) { const lengthLength = data[offset] - 0xb7; if (offset + 1 + lengthLength > data.length) { logger.throwError("data array too short", logger_lib_esm.Logger.errors.BUFFER_OVERRUN, {}); } const length = unarrayifyInteger(data, offset + 1, lengthLength); if (offset + 1 + lengthLength + length > data.length) { logger.throwError("data array too short", logger_lib_esm.Logger.errors.BUFFER_OVERRUN, {}); } const result = (0,lib_esm.hexlify)(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length)); return { consumed: (1 + lengthLength + length), result: result }; } else if (data[offset] >= 0x80) { const length = data[offset] - 0x80; if (offset + 1 + length > data.length) { logger.throwError("data too short", logger_lib_esm.Logger.errors.BUFFER_OVERRUN, {}); } const result = (0,lib_esm.hexlify)(data.slice(offset + 1, offset + 1 + length)); return { consumed: (1 + length), result: result }; } return { consumed: 1, result: (0,lib_esm.hexlify)(data[offset]) }; } function decode(data) { const bytes = (0,lib_esm.arrayify)(data); const decoded = _decode(bytes, 0); if (decoded.consumed !== bytes.length) { logger.throwArgumentError("invalid rlp data", "data", data); } return decoded.result; } //# sourceMappingURL=index.js.map /***/ }), /***/ 91278: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "SupportedAlgorithm": function() { return /* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_1__.p; }, /* harmony export */ "computeHmac": function() { return /* reexport safe */ _sha2__WEBPACK_IMPORTED_MODULE_0__.Gy; }, /* harmony export */ "ripemd160": function() { return /* reexport safe */ _sha2__WEBPACK_IMPORTED_MODULE_0__.bP; }, /* harmony export */ "sha256": function() { return /* reexport safe */ _sha2__WEBPACK_IMPORTED_MODULE_0__.JQ; }, /* harmony export */ "sha512": function() { return /* reexport safe */ _sha2__WEBPACK_IMPORTED_MODULE_0__.o; } /* harmony export */ }); /* harmony import */ var _sha2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2006); /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(21261); //# sourceMappingURL=index.js.map /***/ }), /***/ 2006: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { "Gy": function() { return /* binding */ computeHmac; }, "bP": function() { return /* binding */ ripemd160; }, "JQ": function() { return /* binding */ sha256; }, "o": function() { return /* binding */ sha512; } }); // EXTERNAL MODULE: ./node_modules/hash.js/lib/hash.js var hash = __webpack_require__(33715); var hash_default = /*#__PURE__*/__webpack_require__.n(hash); // EXTERNAL MODULE: ./node_modules/@ethersproject/bytes/lib.esm/index.js + 1 modules var lib_esm = __webpack_require__(16441); // EXTERNAL MODULE: ./node_modules/@ethersproject/sha2/lib.esm/types.js var types = __webpack_require__(21261); // EXTERNAL MODULE: ./node_modules/@ethersproject/logger/lib.esm/index.js + 1 modules var logger_lib_esm = __webpack_require__(1581); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/sha2/lib.esm/_version.js const version = "sha2/5.6.1"; //# sourceMappingURL=_version.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/sha2/lib.esm/sha2.js //const _ripemd160 = _hash.ripemd160; const logger = new logger_lib_esm.Logger(version); function ripemd160(data) { return "0x" + (hash_default().ripemd160().update((0,lib_esm.arrayify)(data)).digest("hex")); } function sha256(data) { return "0x" + (hash_default().sha256().update((0,lib_esm.arrayify)(data)).digest("hex")); } function sha512(data) { return "0x" + (hash_default().sha512().update((0,lib_esm.arrayify)(data)).digest("hex")); } function computeHmac(algorithm, key, data) { if (!types/* SupportedAlgorithm */.p[algorithm]) { logger.throwError("unsupported algorithm " + algorithm, logger_lib_esm.Logger.errors.UNSUPPORTED_OPERATION, { operation: "hmac", algorithm: algorithm }); } return "0x" + hash_default().hmac((hash_default())[algorithm], (0,lib_esm.arrayify)(key)).update((0,lib_esm.arrayify)(data)).digest("hex"); } //# sourceMappingURL=sha2.js.map /***/ }), /***/ 21261: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "p": function() { return /* binding */ SupportedAlgorithm; } /* harmony export */ }); var SupportedAlgorithm; (function (SupportedAlgorithm) { SupportedAlgorithm["sha256"] = "sha256"; SupportedAlgorithm["sha512"] = "sha512"; })(SupportedAlgorithm || (SupportedAlgorithm = {})); ; //# sourceMappingURL=types.js.map /***/ }), /***/ 67669: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { "SigningKey": function() { return /* binding */ SigningKey; }, "computePublicKey": function() { return /* binding */ computePublicKey; }, "recoverPublicKey": function() { return /* binding */ recoverPublicKey; } }); // EXTERNAL MODULE: ./node_modules/@ethersproject/signing-key/node_modules/bn.js/lib/bn.js var bn = __webpack_require__(42500); var bn_default = /*#__PURE__*/__webpack_require__.n(bn); // EXTERNAL MODULE: ./node_modules/hash.js/lib/hash.js var hash = __webpack_require__(33715); var hash_default = /*#__PURE__*/__webpack_require__.n(hash); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/signing-key/lib.esm/elliptic.js var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof self !== 'undefined' ? self : {}; function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } function createCommonjsModule(fn, basedir, module) { return module = { path: basedir, exports: {}, require: function (path, base) { return commonjsRequire(path, (base === undefined || base === null) ? module.path : base); } }, fn(module, module.exports), module.exports; } function getDefaultExportFromNamespaceIfPresent (n) { return n && Object.prototype.hasOwnProperty.call(n, 'default') ? n['default'] : n; } function getDefaultExportFromNamespaceIfNotNamed (n) { return n && Object.prototype.hasOwnProperty.call(n, 'default') && Object.keys(n).length === 1 ? n['default'] : n; } function getAugmentedNamespace(n) { if (n.__esModule) return n; var a = Object.defineProperty({}, '__esModule', {value: true}); Object.keys(n).forEach(function (k) { var d = Object.getOwnPropertyDescriptor(n, k); Object.defineProperty(a, k, d.get ? d : { enumerable: true, get: function () { return n[k]; } }); }); return a; } function commonjsRequire () { throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs'); } var minimalisticAssert = assert; function assert(val, msg) { if (!val) throw new Error(msg || 'Assertion failed'); } assert.equal = function assertEqual(l, r, msg) { if (l != r) throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r)); }; var utils_1 = createCommonjsModule(function (module, exports) { 'use strict'; var utils = exports; function toArray(msg, enc) { if (Array.isArray(msg)) return msg.slice(); if (!msg) return []; var res = []; if (typeof msg !== 'string') { for (var i = 0; i < msg.length; i++) res[i] = msg[i] | 0; return res; } if (enc === 'hex') { msg = msg.replace(/[^a-z0-9]+/ig, ''); if (msg.length % 2 !== 0) msg = '0' + msg; for (var i = 0; i < msg.length; i += 2) res.push(parseInt(msg[i] + msg[i + 1], 16)); } else { for (var i = 0; i < msg.length; i++) { var c = msg.charCodeAt(i); var hi = c >> 8; var lo = c & 0xff; if (hi) res.push(hi, lo); else res.push(lo); } } return res; } utils.toArray = toArray; function zero2(word) { if (word.length === 1) return '0' + word; else return word; } utils.zero2 = zero2; function toHex(msg) { var res = ''; for (var i = 0; i < msg.length; i++) res += zero2(msg[i].toString(16)); return res; } utils.toHex = toHex; utils.encode = function encode(arr, enc) { if (enc === 'hex') return toHex(arr); else return arr; }; }); var utils_1$1 = createCommonjsModule(function (module, exports) { 'use strict'; var utils = exports; utils.assert = minimalisticAssert; utils.toArray = utils_1.toArray; utils.zero2 = utils_1.zero2; utils.toHex = utils_1.toHex; utils.encode = utils_1.encode; // Represent num in a w-NAF form function getNAF(num, w, bits) { var naf = new Array(Math.max(num.bitLength(), bits) + 1); naf.fill(0); var ws = 1 << (w + 1); var k = num.clone(); for (var i = 0; i < naf.length; i++) { var z; var mod = k.andln(ws - 1); if (k.isOdd()) { if (mod > (ws >> 1) - 1) z = (ws >> 1) - mod; else z = mod; k.isubn(z); } else { z = 0; } naf[i] = z; k.iushrn(1); } return naf; } utils.getNAF = getNAF; // Represent k1, k2 in a Joint Sparse Form function getJSF(k1, k2) { var jsf = [ [], [], ]; k1 = k1.clone(); k2 = k2.clone(); var d1 = 0; var d2 = 0; var m8; while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) { // First phase var m14 = (k1.andln(3) + d1) & 3; var m24 = (k2.andln(3) + d2) & 3; if (m14 === 3) m14 = -1; if (m24 === 3) m24 = -1; var u1; if ((m14 & 1) === 0) { u1 = 0; } else { m8 = (k1.andln(7) + d1) & 7; if ((m8 === 3 || m8 === 5) && m24 === 2) u1 = -m14; else u1 = m14; } jsf[0].push(u1); var u2; if ((m24 & 1) === 0) { u2 = 0; } else { m8 = (k2.andln(7) + d2) & 7; if ((m8 === 3 || m8 === 5) && m14 === 2) u2 = -m24; else u2 = m24; } jsf[1].push(u2); // Second phase if (2 * d1 === u1 + 1) d1 = 1 - d1; if (2 * d2 === u2 + 1) d2 = 1 - d2; k1.iushrn(1); k2.iushrn(1); } return jsf; } utils.getJSF = getJSF; function cachedProperty(obj, name, computer) { var key = '_' + name; obj.prototype[name] = function cachedProperty() { return this[key] !== undefined ? this[key] : this[key] = computer.call(this); }; } utils.cachedProperty = cachedProperty; function parseBytes(bytes) { return typeof bytes === 'string' ? utils.toArray(bytes, 'hex') : bytes; } utils.parseBytes = parseBytes; function intFromLE(bytes) { return new (bn_default())(bytes, 'hex', 'le'); } utils.intFromLE = intFromLE; }); 'use strict'; var getNAF = utils_1$1.getNAF; var getJSF = utils_1$1.getJSF; var assert$1 = utils_1$1.assert; function BaseCurve(type, conf) { this.type = type; this.p = new (bn_default())(conf.p, 16); // Use Montgomery, when there is no fast reduction for the prime this.red = conf.prime ? bn_default().red(conf.prime) : bn_default().mont(this.p); // Useful for many curves this.zero = new (bn_default())(0).toRed(this.red); this.one = new (bn_default())(1).toRed(this.red); this.two = new (bn_default())(2).toRed(this.red); // Curve configuration, optional this.n = conf.n && new (bn_default())(conf.n, 16); this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed); // Temporary arrays this._wnafT1 = new Array(4); this._wnafT2 = new Array(4); this._wnafT3 = new Array(4); this._wnafT4 = new Array(4); this._bitLength = this.n ? this.n.bitLength() : 0; // Generalized Greg Maxwell's trick var adjustCount = this.n && this.p.div(this.n); if (!adjustCount || adjustCount.cmpn(100) > 0) { this.redN = null; } else { this._maxwellTrick = true; this.redN = this.n.toRed(this.red); } } var base = BaseCurve; BaseCurve.prototype.point = function point() { throw new Error('Not implemented'); }; BaseCurve.prototype.validate = function validate() { throw new Error('Not implemented'); }; BaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) { assert$1(p.precomputed); var doubles = p._getDoubles(); var naf = getNAF(k, 1, this._bitLength); var I = (1 << (doubles.step + 1)) - (doubles.step % 2 === 0 ? 2 : 1); I /= 3; // Translate into more windowed form var repr = []; var j; var nafW; for (j = 0; j < naf.length; j += doubles.step) { nafW = 0; for (var l = j + doubles.step - 1; l >= j; l--) nafW = (nafW << 1) + naf[l]; repr.push(nafW); } var a = this.jpoint(null, null, null); var b = this.jpoint(null, null, null); for (var i = I; i > 0; i--) { for (j = 0; j < repr.length; j++) { nafW = repr[j]; if (nafW === i) b = b.mixedAdd(doubles.points[j]); else if (nafW === -i) b = b.mixedAdd(doubles.points[j].neg()); } a = a.add(b); } return a.toP(); }; BaseCurve.prototype._wnafMul = function _wnafMul(p, k) { var w = 4; // Precompute window var nafPoints = p._getNAFPoints(w); w = nafPoints.wnd; var wnd = nafPoints.points; // Get NAF form var naf = getNAF(k, w, this._bitLength); // Add `this`*(N+1) for every w-NAF index var acc = this.jpoint(null, null, null); for (var i = naf.length - 1; i >= 0; i--) { // Count zeroes for (var l = 0; i >= 0 && naf[i] === 0; i--) l++; if (i >= 0) l++; acc = acc.dblp(l); if (i < 0) break; var z = naf[i]; assert$1(z !== 0); if (p.type === 'affine') { // J +- P if (z > 0) acc = acc.mixedAdd(wnd[(z - 1) >> 1]); else acc = acc.mixedAdd(wnd[(-z - 1) >> 1].neg()); } else { // J +- J if (z > 0) acc = acc.add(wnd[(z - 1) >> 1]); else acc = acc.add(wnd[(-z - 1) >> 1].neg()); } } return p.type === 'affine' ? acc.toP() : acc; }; BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW, points, coeffs, len, jacobianResult) { var wndWidth = this._wnafT1; var wnd = this._wnafT2; var naf = this._wnafT3; // Fill all arrays var max = 0; var i; var j; var p; for (i = 0; i < len; i++) { p = points[i]; var nafPoints = p._getNAFPoints(defW); wndWidth[i] = nafPoints.wnd; wnd[i] = nafPoints.points; } // Comb small window NAFs for (i = len - 1; i >= 1; i -= 2) { var a = i - 1; var b = i; if (wndWidth[a] !== 1 || wndWidth[b] !== 1) { naf[a] = getNAF(coeffs[a], wndWidth[a], this._bitLength); naf[b] = getNAF(coeffs[b], wndWidth[b], this._bitLength); max = Math.max(naf[a].length, max); max = Math.max(naf[b].length, max); continue; } var comb = [ points[a], /* 1 */ null, /* 3 */ null, /* 5 */ points[b], /* 7 */ ]; // Try to avoid Projective points, if possible if (points[a].y.cmp(points[b].y) === 0) { comb[1] = points[a].add(points[b]); comb[2] = points[a].toJ().mixedAdd(points[b].neg()); } else if (points[a].y.cmp(points[b].y.redNeg()) === 0) { comb[1] = points[a].toJ().mixedAdd(points[b]); comb[2] = points[a].add(points[b].neg()); } else { comb[1] = points[a].toJ().mixedAdd(points[b]); comb[2] = points[a].toJ().mixedAdd(points[b].neg()); } var index = [ -3, /* -1 -1 */ -1, /* -1 0 */ -5, /* -1 1 */ -7, /* 0 -1 */ 0, /* 0 0 */ 7, /* 0 1 */ 5, /* 1 -1 */ 1, /* 1 0 */ 3, /* 1 1 */ ]; var jsf = getJSF(coeffs[a], coeffs[b]); max = Math.max(jsf[0].length, max); naf[a] = new Array(max); naf[b] = new Array(max); for (j = 0; j < max; j++) { var ja = jsf[0][j] | 0; var jb = jsf[1][j] | 0; naf[a][j] = index[(ja + 1) * 3 + (jb + 1)]; naf[b][j] = 0; wnd[a] = comb; } } var acc = this.jpoint(null, null, null); var tmp = this._wnafT4; for (i = max; i >= 0; i--) { var k = 0; while (i >= 0) { var zero = true; for (j = 0; j < len; j++) { tmp[j] = naf[j][i] | 0; if (tmp[j] !== 0) zero = false; } if (!zero) break; k++; i--; } if (i >= 0) k++; acc = acc.dblp(k); if (i < 0) break; for (j = 0; j < len; j++) { var z = tmp[j]; p; if (z === 0) continue; else if (z > 0) p = wnd[j][(z - 1) >> 1]; else if (z < 0) p = wnd[j][(-z - 1) >> 1].neg(); if (p.type === 'affine') acc = acc.mixedAdd(p); else acc = acc.add(p); } } // Zeroify references for (i = 0; i < len; i++) wnd[i] = null; if (jacobianResult) return acc; else return acc.toP(); }; function BasePoint(curve, type) { this.curve = curve; this.type = type; this.precomputed = null; } BaseCurve.BasePoint = BasePoint; BasePoint.prototype.eq = function eq(/*other*/) { throw new Error('Not implemented'); }; BasePoint.prototype.validate = function validate() { return this.curve.validate(this); }; BaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) { bytes = utils_1$1.toArray(bytes, enc); var len = this.p.byteLength(); // uncompressed, hybrid-odd, hybrid-even if ((bytes[0] === 0x04 || bytes[0] === 0x06 || bytes[0] === 0x07) && bytes.length - 1 === 2 * len) { if (bytes[0] === 0x06) assert$1(bytes[bytes.length - 1] % 2 === 0); else if (bytes[0] === 0x07) assert$1(bytes[bytes.length - 1] % 2 === 1); var res = this.point(bytes.slice(1, 1 + len), bytes.slice(1 + len, 1 + 2 * len)); return res; } else if ((bytes[0] === 0x02 || bytes[0] === 0x03) && bytes.length - 1 === len) { return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 0x03); } throw new Error('Unknown point format'); }; BasePoint.prototype.encodeCompressed = function encodeCompressed(enc) { return this.encode(enc, true); }; BasePoint.prototype._encode = function _encode(compact) { var len = this.curve.p.byteLength(); var x = this.getX().toArray('be', len); if (compact) return [ this.getY().isEven() ? 0x02 : 0x03 ].concat(x); return [ 0x04 ].concat(x, this.getY().toArray('be', len)); }; BasePoint.prototype.encode = function encode(enc, compact) { return utils_1$1.encode(this._encode(compact), enc); }; BasePoint.prototype.precompute = function precompute(power) { if (this.precomputed) return this; var precomputed = { doubles: null, naf: null, beta: null, }; precomputed.naf = this._getNAFPoints(8); precomputed.doubles = this._getDoubles(4, power); precomputed.beta = this._getBeta(); this.precomputed = precomputed; return this; }; BasePoint.prototype._hasDoubles = function _hasDoubles(k) { if (!this.precomputed) return false; var doubles = this.precomputed.doubles; if (!doubles) return false; return doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step); }; BasePoint.prototype._getDoubles = function _getDoubles(step, power) { if (this.precomputed && this.precomputed.doubles) return this.precomputed.doubles; var doubles = [ this ]; var acc = this; for (var i = 0; i < power; i += step) { for (var j = 0; j < step; j++) acc = acc.dbl(); doubles.push(acc); } return { step: step, points: doubles, }; }; BasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) { if (this.precomputed && this.precomputed.naf) return this.precomputed.naf; var res = [ this ]; var max = (1 << wnd) - 1; var dbl = max === 1 ? null : this.dbl(); for (var i = 1; i < max; i++) res[i] = res[i - 1].add(dbl); return { wnd: wnd, points: res, }; }; BasePoint.prototype._getBeta = function _getBeta() { return null; }; BasePoint.prototype.dblp = function dblp(k) { var r = this; for (var i = 0; i < k; i++) r = r.dbl(); return r; }; var inherits_browser = createCommonjsModule(function (module) { if (typeof Object.create === 'function') { // implementation from standard node.js 'util' module module.exports = function inherits(ctor, superCtor) { if (superCtor) { ctor.super_ = superCtor; ctor.prototype = Object.create(superCtor.prototype, { constructor: { value: ctor, enumerable: false, writable: true, configurable: true } }); } }; } else { // old school shim for old browsers module.exports = function inherits(ctor, superCtor) { if (superCtor) { ctor.super_ = superCtor; var TempCtor = function () {}; TempCtor.prototype = superCtor.prototype; ctor.prototype = new TempCtor(); ctor.prototype.constructor = ctor; } }; } }); 'use strict'; var assert$2 = utils_1$1.assert; function ShortCurve(conf) { base.call(this, 'short', conf); this.a = new (bn_default())(conf.a, 16).toRed(this.red); this.b = new (bn_default())(conf.b, 16).toRed(this.red); this.tinv = this.two.redInvm(); this.zeroA = this.a.fromRed().cmpn(0) === 0; this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0; // If the curve is endomorphic, precalculate beta and lambda this.endo = this._getEndomorphism(conf); this._endoWnafT1 = new Array(4); this._endoWnafT2 = new Array(4); } inherits_browser(ShortCurve, base); var short_1 = ShortCurve; ShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) { // No efficient endomorphism if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1) return; // Compute beta and lambda, that lambda * P = (beta * Px; Py) var beta; var lambda; if (conf.beta) { beta = new (bn_default())(conf.beta, 16).toRed(this.red); } else { var betas = this._getEndoRoots(this.p); // Choose the smallest beta beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1]; beta = beta.toRed(this.red); } if (conf.lambda) { lambda = new (bn_default())(conf.lambda, 16); } else { // Choose the lambda that is matching selected beta var lambdas = this._getEndoRoots(this.n); if (this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0) { lambda = lambdas[0]; } else { lambda = lambdas[1]; assert$2(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0); } } // Get basis vectors, used for balanced length-two representation var basis; if (conf.basis) { basis = conf.basis.map(function(vec) { return { a: new (bn_default())(vec.a, 16), b: new (bn_default())(vec.b, 16), }; }); } else { basis = this._getEndoBasis(lambda); } return { beta: beta, lambda: lambda, basis: basis, }; }; ShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) { // Find roots of for x^2 + x + 1 in F // Root = (-1 +- Sqrt(-3)) / 2 // var red = num === this.p ? this.red : bn_default().mont(num); var tinv = new (bn_default())(2).toRed(red).redInvm(); var ntinv = tinv.redNeg(); var s = new (bn_default())(3).toRed(red).redNeg().redSqrt().redMul(tinv); var l1 = ntinv.redAdd(s).fromRed(); var l2 = ntinv.redSub(s).fromRed(); return [ l1, l2 ]; }; ShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) { // aprxSqrt >= sqrt(this.n) var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2)); // 3.74 // Run EGCD, until r(L + 1) < aprxSqrt var u = lambda; var v = this.n.clone(); var x1 = new (bn_default())(1); var y1 = new (bn_default())(0); var x2 = new (bn_default())(0); var y2 = new (bn_default())(1); // NOTE: all vectors are roots of: a + b * lambda = 0 (mod n) var a0; var b0; // First vector var a1; var b1; // Second vector var a2; var b2; var prevR; var i = 0; var r; var x; while (u.cmpn(0) !== 0) { var q = v.div(u); r = v.sub(q.mul(u)); x = x2.sub(q.mul(x1)); var y = y2.sub(q.mul(y1)); if (!a1 && r.cmp(aprxSqrt) < 0) { a0 = prevR.neg(); b0 = x1; a1 = r.neg(); b1 = x; } else if (a1 && ++i === 2) { break; } prevR = r; v = u; u = r; x2 = x1; x1 = x; y2 = y1; y1 = y; } a2 = r.neg(); b2 = x; var len1 = a1.sqr().add(b1.sqr()); var len2 = a2.sqr().add(b2.sqr()); if (len2.cmp(len1) >= 0) { a2 = a0; b2 = b0; } // Normalize signs if (a1.negative) { a1 = a1.neg(); b1 = b1.neg(); } if (a2.negative) { a2 = a2.neg(); b2 = b2.neg(); } return [ { a: a1, b: b1 }, { a: a2, b: b2 }, ]; }; ShortCurve.prototype._endoSplit = function _endoSplit(k) { var basis = this.endo.basis; var v1 = basis[0]; var v2 = basis[1]; var c1 = v2.b.mul(k).divRound(this.n); var c2 = v1.b.neg().mul(k).divRound(this.n); var p1 = c1.mul(v1.a); var p2 = c2.mul(v2.a); var q1 = c1.mul(v1.b); var q2 = c2.mul(v2.b); // Calculate answer var k1 = k.sub(p1).sub(p2); var k2 = q1.add(q2).neg(); return { k1: k1, k2: k2 }; }; ShortCurve.prototype.pointFromX = function pointFromX(x, odd) { x = new (bn_default())(x, 16); if (!x.red) x = x.toRed(this.red); var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b); var y = y2.redSqrt(); if (y.redSqr().redSub(y2).cmp(this.zero) !== 0) throw new Error('invalid point'); // XXX Is there any way to tell if the number is odd without converting it // to non-red form? var isOdd = y.fromRed().isOdd(); if (odd && !isOdd || !odd && isOdd) y = y.redNeg(); return this.point(x, y); }; ShortCurve.prototype.validate = function validate(point) { if (point.inf) return true; var x = point.x; var y = point.y; var ax = this.a.redMul(x); var rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b); return y.redSqr().redISub(rhs).cmpn(0) === 0; }; ShortCurve.prototype._endoWnafMulAdd = function _endoWnafMulAdd(points, coeffs, jacobianResult) { var npoints = this._endoWnafT1; var ncoeffs = this._endoWnafT2; for (var i = 0; i < points.length; i++) { var split = this._endoSplit(coeffs[i]); var p = points[i]; var beta = p._getBeta(); if (split.k1.negative) { split.k1.ineg(); p = p.neg(true); } if (split.k2.negative) { split.k2.ineg(); beta = beta.neg(true); } npoints[i * 2] = p; npoints[i * 2 + 1] = beta; ncoeffs[i * 2] = split.k1; ncoeffs[i * 2 + 1] = split.k2; } var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2, jacobianResult); // Clean-up references to points and coefficients for (var j = 0; j < i * 2; j++) { npoints[j] = null; ncoeffs[j] = null; } return res; }; function Point(curve, x, y, isRed) { base.BasePoint.call(this, curve, 'affine'); if (x === null && y === null) { this.x = null; this.y = null; this.inf = true; } else { this.x = new (bn_default())(x, 16); this.y = new (bn_default())(y, 16); // Force redgomery representation when loading from JSON if (isRed) { this.x.forceRed(this.curve.red); this.y.forceRed(this.curve.red); } if (!this.x.red) this.x = this.x.toRed(this.curve.red); if (!this.y.red) this.y = this.y.toRed(this.curve.red); this.inf = false; } } inherits_browser(Point, base.BasePoint); ShortCurve.prototype.point = function point(x, y, isRed) { return new Point(this, x, y, isRed); }; ShortCurve.prototype.pointFromJSON = function pointFromJSON(obj, red) { return Point.fromJSON(this, obj, red); }; Point.prototype._getBeta = function _getBeta() { if (!this.curve.endo) return; var pre = this.precomputed; if (pre && pre.beta) return pre.beta; var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y); if (pre) { var curve = this.curve; var endoMul = function(p) { return curve.point(p.x.redMul(curve.endo.beta), p.y); }; pre.beta = beta; beta.precomputed = { beta: null, naf: pre.naf && { wnd: pre.naf.wnd, points: pre.naf.points.map(endoMul), }, doubles: pre.doubles && { step: pre.doubles.step, points: pre.doubles.points.map(endoMul), }, }; } return beta; }; Point.prototype.toJSON = function toJSON() { if (!this.precomputed) return [ this.x, this.y ]; return [ this.x, this.y, this.precomputed && { doubles: this.precomputed.doubles && { step: this.precomputed.doubles.step, points: this.precomputed.doubles.points.slice(1), }, naf: this.precomputed.naf && { wnd: this.precomputed.naf.wnd, points: this.precomputed.naf.points.slice(1), }, } ]; }; Point.fromJSON = function fromJSON(curve, obj, red) { if (typeof obj === 'string') obj = JSON.parse(obj); var res = curve.point(obj[0], obj[1], red); if (!obj[2]) return res; function obj2point(obj) { return curve.point(obj[0], obj[1], red); } var pre = obj[2]; res.precomputed = { beta: null, doubles: pre.doubles && { step: pre.doubles.step, points: [ res ].concat(pre.doubles.points.map(obj2point)), }, naf: pre.naf && { wnd: pre.naf.wnd, points: [ res ].concat(pre.naf.points.map(obj2point)), }, }; return res; }; Point.prototype.inspect = function inspect() { if (this.isInfinity()) return ''; return ''; }; Point.prototype.isInfinity = function isInfinity() { return this.inf; }; Point.prototype.add = function add(p) { // O + P = P if (this.inf) return p; // P + O = P if (p.inf) return this; // P + P = 2P if (this.eq(p)) return this.dbl(); // P + (-P) = O if (this.neg().eq(p)) return this.curve.point(null, null); // P + Q = O if (this.x.cmp(p.x) === 0) return this.curve.point(null, null); var c = this.y.redSub(p.y); if (c.cmpn(0) !== 0) c = c.redMul(this.x.redSub(p.x).redInvm()); var nx = c.redSqr().redISub(this.x).redISub(p.x); var ny = c.redMul(this.x.redSub(nx)).redISub(this.y); return this.curve.point(nx, ny); }; Point.prototype.dbl = function dbl() { if (this.inf) return this; // 2P = O var ys1 = this.y.redAdd(this.y); if (ys1.cmpn(0) === 0) return this.curve.point(null, null); var a = this.curve.a; var x2 = this.x.redSqr(); var dyinv = ys1.redInvm(); var c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv); var nx = c.redSqr().redISub(this.x.redAdd(this.x)); var ny = c.redMul(this.x.redSub(nx)).redISub(this.y); return this.curve.point(nx, ny); }; Point.prototype.getX = function getX() { return this.x.fromRed(); }; Point.prototype.getY = function getY() { return this.y.fromRed(); }; Point.prototype.mul = function mul(k) { k = new (bn_default())(k, 16); if (this.isInfinity()) return this; else if (this._hasDoubles(k)) return this.curve._fixedNafMul(this, k); else if (this.curve.endo) return this.curve._endoWnafMulAdd([ this ], [ k ]); else return this.curve._wnafMul(this, k); }; Point.prototype.mulAdd = function mulAdd(k1, p2, k2) { var points = [ this, p2 ]; var coeffs = [ k1, k2 ]; if (this.curve.endo) return this.curve._endoWnafMulAdd(points, coeffs); else return this.curve._wnafMulAdd(1, points, coeffs, 2); }; Point.prototype.jmulAdd = function jmulAdd(k1, p2, k2) { var points = [ this, p2 ]; var coeffs = [ k1, k2 ]; if (this.curve.endo) return this.curve._endoWnafMulAdd(points, coeffs, true); else return this.curve._wnafMulAdd(1, points, coeffs, 2, true); }; Point.prototype.eq = function eq(p) { return this === p || this.inf === p.inf && (this.inf || this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0); }; Point.prototype.neg = function neg(_precompute) { if (this.inf) return this; var res = this.curve.point(this.x, this.y.redNeg()); if (_precompute && this.precomputed) { var pre = this.precomputed; var negate = function(p) { return p.neg(); }; res.precomputed = { naf: pre.naf && { wnd: pre.naf.wnd, points: pre.naf.points.map(negate), }, doubles: pre.doubles && { step: pre.doubles.step, points: pre.doubles.points.map(negate), }, }; } return res; }; Point.prototype.toJ = function toJ() { if (this.inf) return this.curve.jpoint(null, null, null); var res = this.curve.jpoint(this.x, this.y, this.curve.one); return res; }; function JPoint(curve, x, y, z) { base.BasePoint.call(this, curve, 'jacobian'); if (x === null && y === null && z === null) { this.x = this.curve.one; this.y = this.curve.one; this.z = new (bn_default())(0); } else { this.x = new (bn_default())(x, 16); this.y = new (bn_default())(y, 16); this.z = new (bn_default())(z, 16); } if (!this.x.red) this.x = this.x.toRed(this.curve.red); if (!this.y.red) this.y = this.y.toRed(this.curve.red); if (!this.z.red) this.z = this.z.toRed(this.curve.red); this.zOne = this.z === this.curve.one; } inherits_browser(JPoint, base.BasePoint); ShortCurve.prototype.jpoint = function jpoint(x, y, z) { return new JPoint(this, x, y, z); }; JPoint.prototype.toP = function toP() { if (this.isInfinity()) return this.curve.point(null, null); var zinv = this.z.redInvm(); var zinv2 = zinv.redSqr(); var ax = this.x.redMul(zinv2); var ay = this.y.redMul(zinv2).redMul(zinv); return this.curve.point(ax, ay); }; JPoint.prototype.neg = function neg() { return this.curve.jpoint(this.x, this.y.redNeg(), this.z); }; JPoint.prototype.add = function add(p) { // O + P = P if (this.isInfinity()) return p; // P + O = P if (p.isInfinity()) return this; // 12M + 4S + 7A var pz2 = p.z.redSqr(); var z2 = this.z.redSqr(); var u1 = this.x.redMul(pz2); var u2 = p.x.redMul(z2); var s1 = this.y.redMul(pz2.redMul(p.z)); var s2 = p.y.redMul(z2.redMul(this.z)); var h = u1.redSub(u2); var r = s1.redSub(s2); if (h.cmpn(0) === 0) { if (r.cmpn(0) !== 0) return this.curve.jpoint(null, null, null); else return this.dbl(); } var h2 = h.redSqr(); var h3 = h2.redMul(h); var v = u1.redMul(h2); var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v); var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)); var nz = this.z.redMul(p.z).redMul(h); return this.curve.jpoint(nx, ny, nz); }; JPoint.prototype.mixedAdd = function mixedAdd(p) { // O + P = P if (this.isInfinity()) return p.toJ(); // P + O = P if (p.isInfinity()) return this; // 8M + 3S + 7A var z2 = this.z.redSqr(); var u1 = this.x; var u2 = p.x.redMul(z2); var s1 = this.y; var s2 = p.y.redMul(z2).redMul(this.z); var h = u1.redSub(u2); var r = s1.redSub(s2); if (h.cmpn(0) === 0) { if (r.cmpn(0) !== 0) return this.curve.jpoint(null, null, null); else return this.dbl(); } var h2 = h.redSqr(); var h3 = h2.redMul(h); var v = u1.redMul(h2); var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v); var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)); var nz = this.z.redMul(h); return this.curve.jpoint(nx, ny, nz); }; JPoint.prototype.dblp = function dblp(pow) { if (pow === 0) return this; if (this.isInfinity()) return this; if (!pow) return this.dbl(); var i; if (this.curve.zeroA || this.curve.threeA) { var r = this; for (i = 0; i < pow; i++) r = r.dbl(); return r; } // 1M + 2S + 1A + N * (4S + 5M + 8A) // N = 1 => 6M + 6S + 9A var a = this.curve.a; var tinv = this.curve.tinv; var jx = this.x; var jy = this.y; var jz = this.z; var jz4 = jz.redSqr().redSqr(); // Reuse results var jyd = jy.redAdd(jy); for (i = 0; i < pow; i++) { var jx2 = jx.redSqr(); var jyd2 = jyd.redSqr(); var jyd4 = jyd2.redSqr(); var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4)); var t1 = jx.redMul(jyd2); var nx = c.redSqr().redISub(t1.redAdd(t1)); var t2 = t1.redISub(nx); var dny = c.redMul(t2); dny = dny.redIAdd(dny).redISub(jyd4); var nz = jyd.redMul(jz); if (i + 1 < pow) jz4 = jz4.redMul(jyd4); jx = nx; jz = nz; jyd = dny; } return this.curve.jpoint(jx, jyd.redMul(tinv), jz); }; JPoint.prototype.dbl = function dbl() { if (this.isInfinity()) return this; if (this.curve.zeroA) return this._zeroDbl(); else if (this.curve.threeA) return this._threeDbl(); else return this._dbl(); }; JPoint.prototype._zeroDbl = function _zeroDbl() { var nx; var ny; var nz; // Z = 1 if (this.zOne) { // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html // #doubling-mdbl-2007-bl // 1M + 5S + 14A // XX = X1^2 var xx = this.x.redSqr(); // YY = Y1^2 var yy = this.y.redSqr(); // YYYY = YY^2 var yyyy = yy.redSqr(); // S = 2 * ((X1 + YY)^2 - XX - YYYY) var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); s = s.redIAdd(s); // M = 3 * XX + a; a = 0 var m = xx.redAdd(xx).redIAdd(xx); // T = M ^ 2 - 2*S var t = m.redSqr().redISub(s).redISub(s); // 8 * YYYY var yyyy8 = yyyy.redIAdd(yyyy); yyyy8 = yyyy8.redIAdd(yyyy8); yyyy8 = yyyy8.redIAdd(yyyy8); // X3 = T nx = t; // Y3 = M * (S - T) - 8 * YYYY ny = m.redMul(s.redISub(t)).redISub(yyyy8); // Z3 = 2*Y1 nz = this.y.redAdd(this.y); } else { // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html // #doubling-dbl-2009-l // 2M + 5S + 13A // A = X1^2 var a = this.x.redSqr(); // B = Y1^2 var b = this.y.redSqr(); // C = B^2 var c = b.redSqr(); // D = 2 * ((X1 + B)^2 - A - C) var d = this.x.redAdd(b).redSqr().redISub(a).redISub(c); d = d.redIAdd(d); // E = 3 * A var e = a.redAdd(a).redIAdd(a); // F = E^2 var f = e.redSqr(); // 8 * C var c8 = c.redIAdd(c); c8 = c8.redIAdd(c8); c8 = c8.redIAdd(c8); // X3 = F - 2 * D nx = f.redISub(d).redISub(d); // Y3 = E * (D - X3) - 8 * C ny = e.redMul(d.redISub(nx)).redISub(c8); // Z3 = 2 * Y1 * Z1 nz = this.y.redMul(this.z); nz = nz.redIAdd(nz); } return this.curve.jpoint(nx, ny, nz); }; JPoint.prototype._threeDbl = function _threeDbl() { var nx; var ny; var nz; // Z = 1 if (this.zOne) { // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html // #doubling-mdbl-2007-bl // 1M + 5S + 15A // XX = X1^2 var xx = this.x.redSqr(); // YY = Y1^2 var yy = this.y.redSqr(); // YYYY = YY^2 var yyyy = yy.redSqr(); // S = 2 * ((X1 + YY)^2 - XX - YYYY) var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); s = s.redIAdd(s); // M = 3 * XX + a var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a); // T = M^2 - 2 * S var t = m.redSqr().redISub(s).redISub(s); // X3 = T nx = t; // Y3 = M * (S - T) - 8 * YYYY var yyyy8 = yyyy.redIAdd(yyyy); yyyy8 = yyyy8.redIAdd(yyyy8); yyyy8 = yyyy8.redIAdd(yyyy8); ny = m.redMul(s.redISub(t)).redISub(yyyy8); // Z3 = 2 * Y1 nz = this.y.redAdd(this.y); } else { // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b // 3M + 5S // delta = Z1^2 var delta = this.z.redSqr(); // gamma = Y1^2 var gamma = this.y.redSqr(); // beta = X1 * gamma var beta = this.x.redMul(gamma); // alpha = 3 * (X1 - delta) * (X1 + delta) var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta)); alpha = alpha.redAdd(alpha).redIAdd(alpha); // X3 = alpha^2 - 8 * beta var beta4 = beta.redIAdd(beta); beta4 = beta4.redIAdd(beta4); var beta8 = beta4.redAdd(beta4); nx = alpha.redSqr().redISub(beta8); // Z3 = (Y1 + Z1)^2 - gamma - delta nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta); // Y3 = alpha * (4 * beta - X3) - 8 * gamma^2 var ggamma8 = gamma.redSqr(); ggamma8 = ggamma8.redIAdd(ggamma8); ggamma8 = ggamma8.redIAdd(ggamma8); ggamma8 = ggamma8.redIAdd(ggamma8); ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8); } return this.curve.jpoint(nx, ny, nz); }; JPoint.prototype._dbl = function _dbl() { var a = this.curve.a; // 4M + 6S + 10A var jx = this.x; var jy = this.y; var jz = this.z; var jz4 = jz.redSqr().redSqr(); var jx2 = jx.redSqr(); var jy2 = jy.redSqr(); var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4)); var jxd4 = jx.redAdd(jx); jxd4 = jxd4.redIAdd(jxd4); var t1 = jxd4.redMul(jy2); var nx = c.redSqr().redISub(t1.redAdd(t1)); var t2 = t1.redISub(nx); var jyd8 = jy2.redSqr(); jyd8 = jyd8.redIAdd(jyd8); jyd8 = jyd8.redIAdd(jyd8); jyd8 = jyd8.redIAdd(jyd8); var ny = c.redMul(t2).redISub(jyd8); var nz = jy.redAdd(jy).redMul(jz); return this.curve.jpoint(nx, ny, nz); }; JPoint.prototype.trpl = function trpl() { if (!this.curve.zeroA) return this.dbl().add(this); // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#tripling-tpl-2007-bl // 5M + 10S + ... // XX = X1^2 var xx = this.x.redSqr(); // YY = Y1^2 var yy = this.y.redSqr(); // ZZ = Z1^2 var zz = this.z.redSqr(); // YYYY = YY^2 var yyyy = yy.redSqr(); // M = 3 * XX + a * ZZ2; a = 0 var m = xx.redAdd(xx).redIAdd(xx); // MM = M^2 var mm = m.redSqr(); // E = 6 * ((X1 + YY)^2 - XX - YYYY) - MM var e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); e = e.redIAdd(e); e = e.redAdd(e).redIAdd(e); e = e.redISub(mm); // EE = E^2 var ee = e.redSqr(); // T = 16*YYYY var t = yyyy.redIAdd(yyyy); t = t.redIAdd(t); t = t.redIAdd(t); t = t.redIAdd(t); // U = (M + E)^2 - MM - EE - T var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t); // X3 = 4 * (X1 * EE - 4 * YY * U) var yyu4 = yy.redMul(u); yyu4 = yyu4.redIAdd(yyu4); yyu4 = yyu4.redIAdd(yyu4); var nx = this.x.redMul(ee).redISub(yyu4); nx = nx.redIAdd(nx); nx = nx.redIAdd(nx); // Y3 = 8 * Y1 * (U * (T - U) - E * EE) var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee))); ny = ny.redIAdd(ny); ny = ny.redIAdd(ny); ny = ny.redIAdd(ny); // Z3 = (Z1 + E)^2 - ZZ - EE var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee); return this.curve.jpoint(nx, ny, nz); }; JPoint.prototype.mul = function mul(k, kbase) { k = new (bn_default())(k, kbase); return this.curve._wnafMul(this, k); }; JPoint.prototype.eq = function eq(p) { if (p.type === 'affine') return this.eq(p.toJ()); if (this === p) return true; // x1 * z2^2 == x2 * z1^2 var z2 = this.z.redSqr(); var pz2 = p.z.redSqr(); if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0) return false; // y1 * z2^3 == y2 * z1^3 var z3 = z2.redMul(this.z); var pz3 = pz2.redMul(p.z); return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0; }; JPoint.prototype.eqXToP = function eqXToP(x) { var zs = this.z.redSqr(); var rx = x.toRed(this.curve.red).redMul(zs); if (this.x.cmp(rx) === 0) return true; var xc = x.clone(); var t = this.curve.redN.redMul(zs); for (;;) { xc.iadd(this.curve.n); if (xc.cmp(this.curve.p) >= 0) return false; rx.redIAdd(t); if (this.x.cmp(rx) === 0) return true; } }; JPoint.prototype.inspect = function inspect() { if (this.isInfinity()) return ''; return ''; }; JPoint.prototype.isInfinity = function isInfinity() { // XXX This code assumes that zero is always zero in red return this.z.cmpn(0) === 0; }; var curve_1 = createCommonjsModule(function (module, exports) { 'use strict'; var curve = exports; curve.base = base; curve.short = short_1; curve.mont = /*RicMoo:ethers:require(./mont)*/(null); curve.edwards = /*RicMoo:ethers:require(./edwards)*/(null); }); var curves_1 = createCommonjsModule(function (module, exports) { 'use strict'; var curves = exports; var assert = utils_1$1.assert; function PresetCurve(options) { if (options.type === 'short') this.curve = new curve_1.short(options); else if (options.type === 'edwards') this.curve = new curve_1.edwards(options); else this.curve = new curve_1.mont(options); this.g = this.curve.g; this.n = this.curve.n; this.hash = options.hash; assert(this.g.validate(), 'Invalid curve'); assert(this.g.mul(this.n).isInfinity(), 'Invalid curve, G*N != O'); } curves.PresetCurve = PresetCurve; function defineCurve(name, options) { Object.defineProperty(curves, name, { configurable: true, enumerable: true, get: function() { var curve = new PresetCurve(options); Object.defineProperty(curves, name, { configurable: true, enumerable: true, value: curve, }); return curve; }, }); } defineCurve('p192', { type: 'short', prime: 'p192', p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff', a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc', b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1', n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831', hash: (hash_default()).sha256, gRed: false, g: [ '188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012', '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811', ], }); defineCurve('p224', { type: 'short', prime: 'p224', p: 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001', a: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe', b: 'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4', n: 'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d', hash: (hash_default()).sha256, gRed: false, g: [ 'b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21', 'bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34', ], }); defineCurve('p256', { type: 'short', prime: null, p: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff', a: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc', b: '5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b', n: 'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551', hash: (hash_default()).sha256, gRed: false, g: [ '6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296', '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5', ], }); defineCurve('p384', { type: 'short', prime: null, p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'fffffffe ffffffff 00000000 00000000 ffffffff', a: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'fffffffe ffffffff 00000000 00000000 fffffffc', b: 'b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f ' + '5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef', n: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 ' + 'f4372ddf 581a0db2 48b0a77a ecec196a ccc52973', hash: (hash_default()).sha384, gRed: false, g: [ 'aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 ' + '5502f25d bf55296c 3a545e38 72760ab7', '3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 ' + '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f', ], }); defineCurve('p521', { type: 'short', prime: null, p: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'ffffffff ffffffff ffffffff ffffffff ffffffff', a: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'ffffffff ffffffff ffffffff ffffffff fffffffc', b: '00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b ' + '99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd ' + '3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00', n: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 ' + 'f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409', hash: (hash_default()).sha512, gRed: false, g: [ '000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 ' + '053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 ' + 'a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66', '00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 ' + '579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 ' + '3fad0761 353c7086 a272c240 88be9476 9fd16650', ], }); defineCurve('curve25519', { type: 'mont', prime: 'p25519', p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed', a: '76d06', b: '1', n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed', hash: (hash_default()).sha256, gRed: false, g: [ '9', ], }); defineCurve('ed25519', { type: 'edwards', prime: 'p25519', p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed', a: '-1', c: '1', // -121665 * (121666^(-1)) (mod P) d: '52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3', n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed', hash: (hash_default()).sha256, gRed: false, g: [ '216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a', // 4/5 '6666666666666666666666666666666666666666666666666666666666666658', ], }); var pre; try { pre = /*RicMoo:ethers:require(./precomputed/secp256k1)*/(null).crash(); } catch (e) { pre = undefined; } defineCurve('secp256k1', { type: 'short', prime: 'k256', p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f', a: '0', b: '7', n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141', h: '1', hash: (hash_default()).sha256, // Precomputed endomorphism beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee', lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72', basis: [ { a: '3086d221a7d46bcde86c90e49284eb15', b: '-e4437ed6010e88286f547fa90abfe4c3', }, { a: '114ca50f7a8e2f3f657c1108d9d44cfd8', b: '3086d221a7d46bcde86c90e49284eb15', }, ], gRed: false, g: [ '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798', '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8', pre, ], }); }); 'use strict'; function HmacDRBG(options) { if (!(this instanceof HmacDRBG)) return new HmacDRBG(options); this.hash = options.hash; this.predResist = !!options.predResist; this.outLen = this.hash.outSize; this.minEntropy = options.minEntropy || this.hash.hmacStrength; this._reseed = null; this.reseedInterval = null; this.K = null; this.V = null; var entropy = utils_1.toArray(options.entropy, options.entropyEnc || 'hex'); var nonce = utils_1.toArray(options.nonce, options.nonceEnc || 'hex'); var pers = utils_1.toArray(options.pers, options.persEnc || 'hex'); minimalisticAssert(entropy.length >= (this.minEntropy / 8), 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits'); this._init(entropy, nonce, pers); } var hmacDrbg = HmacDRBG; HmacDRBG.prototype._init = function init(entropy, nonce, pers) { var seed = entropy.concat(nonce).concat(pers); this.K = new Array(this.outLen / 8); this.V = new Array(this.outLen / 8); for (var i = 0; i < this.V.length; i++) { this.K[i] = 0x00; this.V[i] = 0x01; } this._update(seed); this._reseed = 1; this.reseedInterval = 0x1000000000000; // 2^48 }; HmacDRBG.prototype._hmac = function hmac() { return new (hash_default()).hmac(this.hash, this.K); }; HmacDRBG.prototype._update = function update(seed) { var kmac = this._hmac() .update(this.V) .update([ 0x00 ]); if (seed) kmac = kmac.update(seed); this.K = kmac.digest(); this.V = this._hmac().update(this.V).digest(); if (!seed) return; this.K = this._hmac() .update(this.V) .update([ 0x01 ]) .update(seed) .digest(); this.V = this._hmac().update(this.V).digest(); }; HmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc) { // Optional entropy enc if (typeof entropyEnc !== 'string') { addEnc = add; add = entropyEnc; entropyEnc = null; } entropy = utils_1.toArray(entropy, entropyEnc); add = utils_1.toArray(add, addEnc); minimalisticAssert(entropy.length >= (this.minEntropy / 8), 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits'); this._update(entropy.concat(add || [])); this._reseed = 1; }; HmacDRBG.prototype.generate = function generate(len, enc, add, addEnc) { if (this._reseed > this.reseedInterval) throw new Error('Reseed is required'); // Optional encoding if (typeof enc !== 'string') { addEnc = add; add = enc; enc = null; } // Optional additional data if (add) { add = utils_1.toArray(add, addEnc || 'hex'); this._update(add); } var temp = []; while (temp.length < len) { this.V = this._hmac().update(this.V).digest(); temp = temp.concat(this.V); } var res = temp.slice(0, len); this._update(add); this._reseed++; return utils_1.encode(res, enc); }; 'use strict'; var assert$3 = utils_1$1.assert; function KeyPair(ec, options) { this.ec = ec; this.priv = null; this.pub = null; // KeyPair(ec, { priv: ..., pub: ... }) if (options.priv) this._importPrivate(options.priv, options.privEnc); if (options.pub) this._importPublic(options.pub, options.pubEnc); } var key = KeyPair; KeyPair.fromPublic = function fromPublic(ec, pub, enc) { if (pub instanceof KeyPair) return pub; return new KeyPair(ec, { pub: pub, pubEnc: enc, }); }; KeyPair.fromPrivate = function fromPrivate(ec, priv, enc) { if (priv instanceof KeyPair) return priv; return new KeyPair(ec, { priv: priv, privEnc: enc, }); }; KeyPair.prototype.validate = function validate() { var pub = this.getPublic(); if (pub.isInfinity()) return { result: false, reason: 'Invalid public key' }; if (!pub.validate()) return { result: false, reason: 'Public key is not a point' }; if (!pub.mul(this.ec.curve.n).isInfinity()) return { result: false, reason: 'Public key * N != O' }; return { result: true, reason: null }; }; KeyPair.prototype.getPublic = function getPublic(compact, enc) { // compact is optional argument if (typeof compact === 'string') { enc = compact; compact = null; } if (!this.pub) this.pub = this.ec.g.mul(this.priv); if (!enc) return this.pub; return this.pub.encode(enc, compact); }; KeyPair.prototype.getPrivate = function getPrivate(enc) { if (enc === 'hex') return this.priv.toString(16, 2); else return this.priv; }; KeyPair.prototype._importPrivate = function _importPrivate(key, enc) { this.priv = new (bn_default())(key, enc || 16); // Ensure that the priv won't be bigger than n, otherwise we may fail // in fixed multiplication method this.priv = this.priv.umod(this.ec.curve.n); }; KeyPair.prototype._importPublic = function _importPublic(key, enc) { if (key.x || key.y) { // Montgomery points only have an `x` coordinate. // Weierstrass/Edwards points on the other hand have both `x` and // `y` coordinates. if (this.ec.curve.type === 'mont') { assert$3(key.x, 'Need x coordinate'); } else if (this.ec.curve.type === 'short' || this.ec.curve.type === 'edwards') { assert$3(key.x && key.y, 'Need both x and y coordinate'); } this.pub = this.ec.curve.point(key.x, key.y); return; } this.pub = this.ec.curve.decodePoint(key, enc); }; // ECDH KeyPair.prototype.derive = function derive(pub) { if(!pub.validate()) { assert$3(pub.validate(), 'public point not validated'); } return pub.mul(this.priv).getX(); }; // ECDSA KeyPair.prototype.sign = function sign(msg, enc, options) { return this.ec.sign(msg, this, enc, options); }; KeyPair.prototype.verify = function verify(msg, signature) { return this.ec.verify(msg, signature, this); }; KeyPair.prototype.inspect = function inspect() { return ''; }; 'use strict'; var assert$4 = utils_1$1.assert; function Signature(options, enc) { if (options instanceof Signature) return options; if (this._importDER(options, enc)) return; assert$4(options.r && options.s, 'Signature without r or s'); this.r = new (bn_default())(options.r, 16); this.s = new (bn_default())(options.s, 16); if (options.recoveryParam === undefined) this.recoveryParam = null; else this.recoveryParam = options.recoveryParam; } var signature = Signature; function Position() { this.place = 0; } function getLength(buf, p) { var initial = buf[p.place++]; if (!(initial & 0x80)) { return initial; } var octetLen = initial & 0xf; // Indefinite length or overflow if (octetLen === 0 || octetLen > 4) { return false; } var val = 0; for (var i = 0, off = p.place; i < octetLen; i++, off++) { val <<= 8; val |= buf[off]; val >>>= 0; } // Leading zeroes if (val <= 0x7f) { return false; } p.place = off; return val; } function rmPadding(buf) { var i = 0; var len = buf.length - 1; while (!buf[i] && !(buf[i + 1] & 0x80) && i < len) { i++; } if (i === 0) { return buf; } return buf.slice(i); } Signature.prototype._importDER = function _importDER(data, enc) { data = utils_1$1.toArray(data, enc); var p = new Position(); if (data[p.place++] !== 0x30) { return false; } var len = getLength(data, p); if (len === false) { return false; } if ((len + p.place) !== data.length) { return false; } if (data[p.place++] !== 0x02) { return false; } var rlen = getLength(data, p); if (rlen === false) { return false; } var r = data.slice(p.place, rlen + p.place); p.place += rlen; if (data[p.place++] !== 0x02) { return false; } var slen = getLength(data, p); if (slen === false) { return false; } if (data.length !== slen + p.place) { return false; } var s = data.slice(p.place, slen + p.place); if (r[0] === 0) { if (r[1] & 0x80) { r = r.slice(1); } else { // Leading zeroes return false; } } if (s[0] === 0) { if (s[1] & 0x80) { s = s.slice(1); } else { // Leading zeroes return false; } } this.r = new (bn_default())(r); this.s = new (bn_default())(s); this.recoveryParam = null; return true; }; function constructLength(arr, len) { if (len < 0x80) { arr.push(len); return; } var octets = 1 + (Math.log(len) / Math.LN2 >>> 3); arr.push(octets | 0x80); while (--octets) { arr.push((len >>> (octets << 3)) & 0xff); } arr.push(len); } Signature.prototype.toDER = function toDER(enc) { var r = this.r.toArray(); var s = this.s.toArray(); // Pad values if (r[0] & 0x80) r = [ 0 ].concat(r); // Pad values if (s[0] & 0x80) s = [ 0 ].concat(s); r = rmPadding(r); s = rmPadding(s); while (!s[0] && !(s[1] & 0x80)) { s = s.slice(1); } var arr = [ 0x02 ]; constructLength(arr, r.length); arr = arr.concat(r); arr.push(0x02); constructLength(arr, s.length); var backHalf = arr.concat(s); var res = [ 0x30 ]; constructLength(res, backHalf.length); res = res.concat(backHalf); return utils_1$1.encode(res, enc); }; 'use strict'; var rand = /*RicMoo:ethers:require(brorand)*/(function() { throw new Error('unsupported'); }); var assert$5 = utils_1$1.assert; function EC(options) { if (!(this instanceof EC)) return new EC(options); // Shortcut `elliptic.ec(curve-name)` if (typeof options === 'string') { assert$5(Object.prototype.hasOwnProperty.call(curves_1, options), 'Unknown curve ' + options); options = curves_1[options]; } // Shortcut for `elliptic.ec(elliptic.curves.curveName)` if (options instanceof curves_1.PresetCurve) options = { curve: options }; this.curve = options.curve.curve; this.n = this.curve.n; this.nh = this.n.ushrn(1); this.g = this.curve.g; // Point on curve this.g = options.curve.g; this.g.precompute(options.curve.n.bitLength() + 1); // Hash for function for DRBG this.hash = options.hash || options.curve.hash; } var ec = EC; EC.prototype.keyPair = function keyPair(options) { return new key(this, options); }; EC.prototype.keyFromPrivate = function keyFromPrivate(priv, enc) { return key.fromPrivate(this, priv, enc); }; EC.prototype.keyFromPublic = function keyFromPublic(pub, enc) { return key.fromPublic(this, pub, enc); }; EC.prototype.genKeyPair = function genKeyPair(options) { if (!options) options = {}; // Instantiate Hmac_DRBG var drbg = new hmacDrbg({ hash: this.hash, pers: options.pers, persEnc: options.persEnc || 'utf8', entropy: options.entropy || rand(this.hash.hmacStrength), entropyEnc: options.entropy && options.entropyEnc || 'utf8', nonce: this.n.toArray(), }); var bytes = this.n.byteLength(); var ns2 = this.n.sub(new (bn_default())(2)); for (;;) { var priv = new (bn_default())(drbg.generate(bytes)); if (priv.cmp(ns2) > 0) continue; priv.iaddn(1); return this.keyFromPrivate(priv); } }; EC.prototype._truncateToN = function _truncateToN(msg, truncOnly) { var delta = msg.byteLength() * 8 - this.n.bitLength(); if (delta > 0) msg = msg.ushrn(delta); if (!truncOnly && msg.cmp(this.n) >= 0) return msg.sub(this.n); else return msg; }; EC.prototype.sign = function sign(msg, key, enc, options) { if (typeof enc === 'object') { options = enc; enc = null; } if (!options) options = {}; key = this.keyFromPrivate(key, enc); msg = this._truncateToN(new (bn_default())(msg, 16)); // Zero-extend key to provide enough entropy var bytes = this.n.byteLength(); var bkey = key.getPrivate().toArray('be', bytes); // Zero-extend nonce to have the same byte size as N var nonce = msg.toArray('be', bytes); // Instantiate Hmac_DRBG var drbg = new hmacDrbg({ hash: this.hash, entropy: bkey, nonce: nonce, pers: options.pers, persEnc: options.persEnc || 'utf8', }); // Number of bytes to generate var ns1 = this.n.sub(new (bn_default())(1)); for (var iter = 0; ; iter++) { var k = options.k ? options.k(iter) : new (bn_default())(drbg.generate(this.n.byteLength())); k = this._truncateToN(k, true); if (k.cmpn(1) <= 0 || k.cmp(ns1) >= 0) continue; var kp = this.g.mul(k); if (kp.isInfinity()) continue; var kpX = kp.getX(); var r = kpX.umod(this.n); if (r.cmpn(0) === 0) continue; var s = k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg)); s = s.umod(this.n); if (s.cmpn(0) === 0) continue; var recoveryParam = (kp.getY().isOdd() ? 1 : 0) | (kpX.cmp(r) !== 0 ? 2 : 0); // Use complement of `s`, if it is > `n / 2` if (options.canonical && s.cmp(this.nh) > 0) { s = this.n.sub(s); recoveryParam ^= 1; } return new signature({ r: r, s: s, recoveryParam: recoveryParam }); } }; EC.prototype.verify = function verify(msg, signature$1, key, enc) { msg = this._truncateToN(new (bn_default())(msg, 16)); key = this.keyFromPublic(key, enc); signature$1 = new signature(signature$1, 'hex'); // Perform primitive values validation var r = signature$1.r; var s = signature$1.s; if (r.cmpn(1) < 0 || r.cmp(this.n) >= 0) return false; if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0) return false; // Validate signature var sinv = s.invm(this.n); var u1 = sinv.mul(msg).umod(this.n); var u2 = sinv.mul(r).umod(this.n); var p; if (!this.curve._maxwellTrick) { p = this.g.mulAdd(u1, key.getPublic(), u2); if (p.isInfinity()) return false; return p.getX().umod(this.n).cmp(r) === 0; } // NOTE: Greg Maxwell's trick, inspired by: // https://git.io/vad3K p = this.g.jmulAdd(u1, key.getPublic(), u2); if (p.isInfinity()) return false; // Compare `p.x` of Jacobian point with `r`, // this will do `p.x == r * p.z^2` instead of multiplying `p.x` by the // inverse of `p.z^2` return p.eqXToP(r); }; EC.prototype.recoverPubKey = function(msg, signature$1, j, enc) { assert$5((3 & j) === j, 'The recovery param is more than two bits'); signature$1 = new signature(signature$1, enc); var n = this.n; var e = new (bn_default())(msg); var r = signature$1.r; var s = signature$1.s; // A set LSB signifies that the y-coordinate is odd var isYOdd = j & 1; var isSecondKey = j >> 1; if (r.cmp(this.curve.p.umod(this.curve.n)) >= 0 && isSecondKey) throw new Error('Unable to find sencond key candinate'); // 1.1. Let x = r + jn. if (isSecondKey) r = this.curve.pointFromX(r.add(this.curve.n), isYOdd); else r = this.curve.pointFromX(r, isYOdd); var rInv = signature$1.r.invm(n); var s1 = n.sub(e).mul(rInv).umod(n); var s2 = s.mul(rInv).umod(n); // 1.6.1 Compute Q = r^-1 (sR - eG) // Q = r^-1 (sR + -eG) return this.g.mulAdd(s1, r, s2); }; EC.prototype.getKeyRecoveryParam = function(e, signature$1, Q, enc) { signature$1 = new signature(signature$1, enc); if (signature$1.recoveryParam !== null) return signature$1.recoveryParam; for (var i = 0; i < 4; i++) { var Qprime; try { Qprime = this.recoverPubKey(e, signature$1, i); } catch (e) { continue; } if (Qprime.eq(Q)) return i; } throw new Error('Unable to find valid recovery factor'); }; var elliptic_1 = createCommonjsModule(function (module, exports) { 'use strict'; var elliptic = exports; elliptic.version = /*RicMoo:ethers*/{ version: "6.5.4" }.version; elliptic.utils = utils_1$1; elliptic.rand = /*RicMoo:ethers:require(brorand)*/(function() { throw new Error('unsupported'); }); elliptic.curve = curve_1; elliptic.curves = curves_1; // Protocols elliptic.ec = ec; elliptic.eddsa = /*RicMoo:ethers:require(./elliptic/eddsa)*/(null); }); var EC$1 = elliptic_1.ec; //# sourceMappingURL=elliptic.js.map // EXTERNAL MODULE: ./node_modules/@ethersproject/bytes/lib.esm/index.js + 1 modules var lib_esm = __webpack_require__(16441); // EXTERNAL MODULE: ./node_modules/@ethersproject/properties/lib.esm/index.js + 1 modules var properties_lib_esm = __webpack_require__(6881); // EXTERNAL MODULE: ./node_modules/@ethersproject/logger/lib.esm/index.js + 1 modules var logger_lib_esm = __webpack_require__(1581); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/signing-key/lib.esm/_version.js const version = "signing-key/5.6.2"; //# sourceMappingURL=_version.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/signing-key/lib.esm/index.js const logger = new logger_lib_esm.Logger(version); let _curve = null; function getCurve() { if (!_curve) { _curve = new EC$1("secp256k1"); } return _curve; } class SigningKey { constructor(privateKey) { (0,properties_lib_esm.defineReadOnly)(this, "curve", "secp256k1"); (0,properties_lib_esm.defineReadOnly)(this, "privateKey", (0,lib_esm.hexlify)(privateKey)); if ((0,lib_esm.hexDataLength)(this.privateKey) !== 32) { logger.throwArgumentError("invalid private key", "privateKey", "[[ REDACTED ]]"); } const keyPair = getCurve().keyFromPrivate((0,lib_esm.arrayify)(this.privateKey)); (0,properties_lib_esm.defineReadOnly)(this, "publicKey", "0x" + keyPair.getPublic(false, "hex")); (0,properties_lib_esm.defineReadOnly)(this, "compressedPublicKey", "0x" + keyPair.getPublic(true, "hex")); (0,properties_lib_esm.defineReadOnly)(this, "_isSigningKey", true); } _addPoint(other) { const p0 = getCurve().keyFromPublic((0,lib_esm.arrayify)(this.publicKey)); const p1 = getCurve().keyFromPublic((0,lib_esm.arrayify)(other)); return "0x" + p0.pub.add(p1.pub).encodeCompressed("hex"); } signDigest(digest) { const keyPair = getCurve().keyFromPrivate((0,lib_esm.arrayify)(this.privateKey)); const digestBytes = (0,lib_esm.arrayify)(digest); if (digestBytes.length !== 32) { logger.throwArgumentError("bad digest length", "digest", digest); } const signature = keyPair.sign(digestBytes, { canonical: true }); return (0,lib_esm.splitSignature)({ recoveryParam: signature.recoveryParam, r: (0,lib_esm.hexZeroPad)("0x" + signature.r.toString(16), 32), s: (0,lib_esm.hexZeroPad)("0x" + signature.s.toString(16), 32), }); } computeSharedSecret(otherKey) { const keyPair = getCurve().keyFromPrivate((0,lib_esm.arrayify)(this.privateKey)); const otherKeyPair = getCurve().keyFromPublic((0,lib_esm.arrayify)(computePublicKey(otherKey))); return (0,lib_esm.hexZeroPad)("0x" + keyPair.derive(otherKeyPair.getPublic()).toString(16), 32); } static isSigningKey(value) { return !!(value && value._isSigningKey); } } function recoverPublicKey(digest, signature) { const sig = (0,lib_esm.splitSignature)(signature); const rs = { r: (0,lib_esm.arrayify)(sig.r), s: (0,lib_esm.arrayify)(sig.s) }; return "0x" + getCurve().recoverPubKey((0,lib_esm.arrayify)(digest), rs, sig.recoveryParam).encode("hex", false); } function computePublicKey(key, compressed) { const bytes = (0,lib_esm.arrayify)(key); if (bytes.length === 32) { const signingKey = new SigningKey(bytes); if (compressed) { return "0x" + getCurve().keyFromPrivate(bytes).getPublic(true, "hex"); } return signingKey.publicKey; } else if (bytes.length === 33) { if (compressed) { return (0,lib_esm.hexlify)(bytes); } return "0x" + getCurve().keyFromPublic(bytes).getPublic(false, "hex"); } else if (bytes.length === 65) { if (!compressed) { return (0,lib_esm.hexlify)(bytes); } return "0x" + getCurve().keyFromPublic(bytes).getPublic(true, "hex"); } return logger.throwArgumentError("invalid public or private key", "key", "[REDACTED]"); } //# sourceMappingURL=index.js.map /***/ }), /***/ 42500: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { /* module decorator */ module = __webpack_require__.nmd(module); (function (module, exports) { 'use strict'; // Utils function assert (val, msg) { if (!val) throw new Error(msg || 'Assertion failed'); } // Could use `inherits` module, but don't want to move from single file // architecture yet. function inherits (ctor, superCtor) { ctor.super_ = superCtor; var TempCtor = function () {}; TempCtor.prototype = superCtor.prototype; ctor.prototype = new TempCtor(); ctor.prototype.constructor = ctor; } // BN function BN (number, base, endian) { if (BN.isBN(number)) { return number; } this.negative = 0; this.words = null; this.length = 0; // Reduction context this.red = null; if (number !== null) { if (base === 'le' || base === 'be') { endian = base; base = 10; } this._init(number || 0, base || 10, endian || 'be'); } } if (typeof module === 'object') { module.exports = BN; } else { exports.BN = BN; } BN.BN = BN; BN.wordSize = 26; var Buffer; try { if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') { Buffer = window.Buffer; } else { Buffer = (__webpack_require__(62808).Buffer); } } catch (e) { } BN.isBN = function isBN (num) { if (num instanceof BN) { return true; } return num !== null && typeof num === 'object' && num.constructor.wordSize === BN.wordSize && Array.isArray(num.words); }; BN.max = function max (left, right) { if (left.cmp(right) > 0) return left; return right; }; BN.min = function min (left, right) { if (left.cmp(right) < 0) return left; return right; }; BN.prototype._init = function init (number, base, endian) { if (typeof number === 'number') { return this._initNumber(number, base, endian); } if (typeof number === 'object') { return this._initArray(number, base, endian); } if (base === 'hex') { base = 16; } assert(base === (base | 0) && base >= 2 && base <= 36); number = number.toString().replace(/\s+/g, ''); var start = 0; if (number[0] === '-') { start++; this.negative = 1; } if (start < number.length) { if (base === 16) { this._parseHex(number, start, endian); } else { this._parseBase(number, base, start); if (endian === 'le') { this._initArray(this.toArray(), base, endian); } } } }; BN.prototype._initNumber = function _initNumber (number, base, endian) { if (number < 0) { this.negative = 1; number = -number; } if (number < 0x4000000) { this.words = [number & 0x3ffffff]; this.length = 1; } else if (number < 0x10000000000000) { this.words = [ number & 0x3ffffff, (number / 0x4000000) & 0x3ffffff ]; this.length = 2; } else { assert(number < 0x20000000000000); // 2 ^ 53 (unsafe) this.words = [ number & 0x3ffffff, (number / 0x4000000) & 0x3ffffff, 1 ]; this.length = 3; } if (endian !== 'le') return; // Reverse the bytes this._initArray(this.toArray(), base, endian); }; BN.prototype._initArray = function _initArray (number, base, endian) { // Perhaps a Uint8Array assert(typeof number.length === 'number'); if (number.length <= 0) { this.words = [0]; this.length = 1; return this; } this.length = Math.ceil(number.length / 3); this.words = new Array(this.length); for (var i = 0; i < this.length; i++) { this.words[i] = 0; } var j, w; var off = 0; if (endian === 'be') { for (i = number.length - 1, j = 0; i >= 0; i -= 3) { w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16); this.words[j] |= (w << off) & 0x3ffffff; this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; off += 24; if (off >= 26) { off -= 26; j++; } } } else if (endian === 'le') { for (i = 0, j = 0; i < number.length; i += 3) { w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16); this.words[j] |= (w << off) & 0x3ffffff; this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; off += 24; if (off >= 26) { off -= 26; j++; } } } return this._strip(); }; function parseHex4Bits (string, index) { var c = string.charCodeAt(index); // '0' - '9' if (c >= 48 && c <= 57) { return c - 48; // 'A' - 'F' } else if (c >= 65 && c <= 70) { return c - 55; // 'a' - 'f' } else if (c >= 97 && c <= 102) { return c - 87; } else { assert(false, 'Invalid character in ' + string); } } function parseHexByte (string, lowerBound, index) { var r = parseHex4Bits(string, index); if (index - 1 >= lowerBound) { r |= parseHex4Bits(string, index - 1) << 4; } return r; } BN.prototype._parseHex = function _parseHex (number, start, endian) { // Create possibly bigger array to ensure that it fits the number this.length = Math.ceil((number.length - start) / 6); this.words = new Array(this.length); for (var i = 0; i < this.length; i++) { this.words[i] = 0; } // 24-bits chunks var off = 0; var j = 0; var w; if (endian === 'be') { for (i = number.length - 1; i >= start; i -= 2) { w = parseHexByte(number, start, i) << off; this.words[j] |= w & 0x3ffffff; if (off >= 18) { off -= 18; j += 1; this.words[j] |= w >>> 26; } else { off += 8; } } } else { var parseLength = number.length - start; for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) { w = parseHexByte(number, start, i) << off; this.words[j] |= w & 0x3ffffff; if (off >= 18) { off -= 18; j += 1; this.words[j] |= w >>> 26; } else { off += 8; } } } this._strip(); }; function parseBase (str, start, end, mul) { var r = 0; var b = 0; var len = Math.min(str.length, end); for (var i = start; i < len; i++) { var c = str.charCodeAt(i) - 48; r *= mul; // 'a' if (c >= 49) { b = c - 49 + 0xa; // 'A' } else if (c >= 17) { b = c - 17 + 0xa; // '0' - '9' } else { b = c; } assert(c >= 0 && b < mul, 'Invalid character'); r += b; } return r; } BN.prototype._parseBase = function _parseBase (number, base, start) { // Initialize as zero this.words = [0]; this.length = 1; // Find length of limb in base for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) { limbLen++; } limbLen--; limbPow = (limbPow / base) | 0; var total = number.length - start; var mod = total % limbLen; var end = Math.min(total, total - mod) + start; var word = 0; for (var i = start; i < end; i += limbLen) { word = parseBase(number, i, i + limbLen, base); this.imuln(limbPow); if (this.words[0] + word < 0x4000000) { this.words[0] += word; } else { this._iaddn(word); } } if (mod !== 0) { var pow = 1; word = parseBase(number, i, number.length, base); for (i = 0; i < mod; i++) { pow *= base; } this.imuln(pow); if (this.words[0] + word < 0x4000000) { this.words[0] += word; } else { this._iaddn(word); } } this._strip(); }; BN.prototype.copy = function copy (dest) { dest.words = new Array(this.length); for (var i = 0; i < this.length; i++) { dest.words[i] = this.words[i]; } dest.length = this.length; dest.negative = this.negative; dest.red = this.red; }; function move (dest, src) { dest.words = src.words; dest.length = src.length; dest.negative = src.negative; dest.red = src.red; } BN.prototype._move = function _move (dest) { move(dest, this); }; BN.prototype.clone = function clone () { var r = new BN(null); this.copy(r); return r; }; BN.prototype._expand = function _expand (size) { while (this.length < size) { this.words[this.length++] = 0; } return this; }; // Remove leading `0` from `this` BN.prototype._strip = function strip () { while (this.length > 1 && this.words[this.length - 1] === 0) { this.length--; } return this._normSign(); }; BN.prototype._normSign = function _normSign () { // -0 = 0 if (this.length === 1 && this.words[0] === 0) { this.negative = 0; } return this; }; // Check Symbol.for because not everywhere where Symbol defined // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol#Browser_compatibility if (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function') { try { BN.prototype[Symbol.for('nodejs.util.inspect.custom')] = inspect; } catch (e) { BN.prototype.inspect = inspect; } } else { BN.prototype.inspect = inspect; } function inspect () { return (this.red ? ''; } /* var zeros = []; var groupSizes = []; var groupBases = []; var s = ''; var i = -1; while (++i < BN.wordSize) { zeros[i] = s; s += '0'; } groupSizes[0] = 0; groupSizes[1] = 0; groupBases[0] = 0; groupBases[1] = 0; var base = 2 - 1; while (++base < 36 + 1) { var groupSize = 0; var groupBase = 1; while (groupBase < (1 << BN.wordSize) / base) { groupBase *= base; groupSize += 1; } groupSizes[base] = groupSize; groupBases[base] = groupBase; } */ var zeros = [ '', '0', '00', '000', '0000', '00000', '000000', '0000000', '00000000', '000000000', '0000000000', '00000000000', '000000000000', '0000000000000', '00000000000000', '000000000000000', '0000000000000000', '00000000000000000', '000000000000000000', '0000000000000000000', '00000000000000000000', '000000000000000000000', '0000000000000000000000', '00000000000000000000000', '000000000000000000000000', '0000000000000000000000000' ]; var groupSizes = [ 0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 ]; var groupBases = [ 0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176 ]; BN.prototype.toString = function toString (base, padding) { base = base || 10; padding = padding | 0 || 1; var out; if (base === 16 || base === 'hex') { out = ''; var off = 0; var carry = 0; for (var i = 0; i < this.length; i++) { var w = this.words[i]; var word = (((w << off) | carry) & 0xffffff).toString(16); carry = (w >>> (24 - off)) & 0xffffff; off += 2; if (off >= 26) { off -= 26; i--; } if (carry !== 0 || i !== this.length - 1) { out = zeros[6 - word.length] + word + out; } else { out = word + out; } } if (carry !== 0) { out = carry.toString(16) + out; } while (out.length % padding !== 0) { out = '0' + out; } if (this.negative !== 0) { out = '-' + out; } return out; } if (base === (base | 0) && base >= 2 && base <= 36) { // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base)); var groupSize = groupSizes[base]; // var groupBase = Math.pow(base, groupSize); var groupBase = groupBases[base]; out = ''; var c = this.clone(); c.negative = 0; while (!c.isZero()) { var r = c.modrn(groupBase).toString(base); c = c.idivn(groupBase); if (!c.isZero()) { out = zeros[groupSize - r.length] + r + out; } else { out = r + out; } } if (this.isZero()) { out = '0' + out; } while (out.length % padding !== 0) { out = '0' + out; } if (this.negative !== 0) { out = '-' + out; } return out; } assert(false, 'Base should be between 2 and 36'); }; BN.prototype.toNumber = function toNumber () { var ret = this.words[0]; if (this.length === 2) { ret += this.words[1] * 0x4000000; } else if (this.length === 3 && this.words[2] === 0x01) { // NOTE: at this stage it is known that the top bit is set ret += 0x10000000000000 + (this.words[1] * 0x4000000); } else if (this.length > 2) { assert(false, 'Number can only safely store up to 53 bits'); } return (this.negative !== 0) ? -ret : ret; }; BN.prototype.toJSON = function toJSON () { return this.toString(16, 2); }; if (Buffer) { BN.prototype.toBuffer = function toBuffer (endian, length) { return this.toArrayLike(Buffer, endian, length); }; } BN.prototype.toArray = function toArray (endian, length) { return this.toArrayLike(Array, endian, length); }; var allocate = function allocate (ArrayType, size) { if (ArrayType.allocUnsafe) { return ArrayType.allocUnsafe(size); } return new ArrayType(size); }; BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) { this._strip(); var byteLength = this.byteLength(); var reqLength = length || Math.max(1, byteLength); assert(byteLength <= reqLength, 'byte array longer than desired length'); assert(reqLength > 0, 'Requested array length <= 0'); var res = allocate(ArrayType, reqLength); var postfix = endian === 'le' ? 'LE' : 'BE'; this['_toArrayLike' + postfix](res, byteLength); return res; }; BN.prototype._toArrayLikeLE = function _toArrayLikeLE (res, byteLength) { var position = 0; var carry = 0; for (var i = 0, shift = 0; i < this.length; i++) { var word = (this.words[i] << shift) | carry; res[position++] = word & 0xff; if (position < res.length) { res[position++] = (word >> 8) & 0xff; } if (position < res.length) { res[position++] = (word >> 16) & 0xff; } if (shift === 6) { if (position < res.length) { res[position++] = (word >> 24) & 0xff; } carry = 0; shift = 0; } else { carry = word >>> 24; shift += 2; } } if (position < res.length) { res[position++] = carry; while (position < res.length) { res[position++] = 0; } } }; BN.prototype._toArrayLikeBE = function _toArrayLikeBE (res, byteLength) { var position = res.length - 1; var carry = 0; for (var i = 0, shift = 0; i < this.length; i++) { var word = (this.words[i] << shift) | carry; res[position--] = word & 0xff; if (position >= 0) { res[position--] = (word >> 8) & 0xff; } if (position >= 0) { res[position--] = (word >> 16) & 0xff; } if (shift === 6) { if (position >= 0) { res[position--] = (word >> 24) & 0xff; } carry = 0; shift = 0; } else { carry = word >>> 24; shift += 2; } } if (position >= 0) { res[position--] = carry; while (position >= 0) { res[position--] = 0; } } }; if (Math.clz32) { BN.prototype._countBits = function _countBits (w) { return 32 - Math.clz32(w); }; } else { BN.prototype._countBits = function _countBits (w) { var t = w; var r = 0; if (t >= 0x1000) { r += 13; t >>>= 13; } if (t >= 0x40) { r += 7; t >>>= 7; } if (t >= 0x8) { r += 4; t >>>= 4; } if (t >= 0x02) { r += 2; t >>>= 2; } return r + t; }; } BN.prototype._zeroBits = function _zeroBits (w) { // Short-cut if (w === 0) return 26; var t = w; var r = 0; if ((t & 0x1fff) === 0) { r += 13; t >>>= 13; } if ((t & 0x7f) === 0) { r += 7; t >>>= 7; } if ((t & 0xf) === 0) { r += 4; t >>>= 4; } if ((t & 0x3) === 0) { r += 2; t >>>= 2; } if ((t & 0x1) === 0) { r++; } return r; }; // Return number of used bits in a BN BN.prototype.bitLength = function bitLength () { var w = this.words[this.length - 1]; var hi = this._countBits(w); return (this.length - 1) * 26 + hi; }; function toBitArray (num) { var w = new Array(num.bitLength()); for (var bit = 0; bit < w.length; bit++) { var off = (bit / 26) | 0; var wbit = bit % 26; w[bit] = (num.words[off] >>> wbit) & 0x01; } return w; } // Number of trailing zero bits BN.prototype.zeroBits = function zeroBits () { if (this.isZero()) return 0; var r = 0; for (var i = 0; i < this.length; i++) { var b = this._zeroBits(this.words[i]); r += b; if (b !== 26) break; } return r; }; BN.prototype.byteLength = function byteLength () { return Math.ceil(this.bitLength() / 8); }; BN.prototype.toTwos = function toTwos (width) { if (this.negative !== 0) { return this.abs().inotn(width).iaddn(1); } return this.clone(); }; BN.prototype.fromTwos = function fromTwos (width) { if (this.testn(width - 1)) { return this.notn(width).iaddn(1).ineg(); } return this.clone(); }; BN.prototype.isNeg = function isNeg () { return this.negative !== 0; }; // Return negative clone of `this` BN.prototype.neg = function neg () { return this.clone().ineg(); }; BN.prototype.ineg = function ineg () { if (!this.isZero()) { this.negative ^= 1; } return this; }; // Or `num` with `this` in-place BN.prototype.iuor = function iuor (num) { while (this.length < num.length) { this.words[this.length++] = 0; } for (var i = 0; i < num.length; i++) { this.words[i] = this.words[i] | num.words[i]; } return this._strip(); }; BN.prototype.ior = function ior (num) { assert((this.negative | num.negative) === 0); return this.iuor(num); }; // Or `num` with `this` BN.prototype.or = function or (num) { if (this.length > num.length) return this.clone().ior(num); return num.clone().ior(this); }; BN.prototype.uor = function uor (num) { if (this.length > num.length) return this.clone().iuor(num); return num.clone().iuor(this); }; // And `num` with `this` in-place BN.prototype.iuand = function iuand (num) { // b = min-length(num, this) var b; if (this.length > num.length) { b = num; } else { b = this; } for (var i = 0; i < b.length; i++) { this.words[i] = this.words[i] & num.words[i]; } this.length = b.length; return this._strip(); }; BN.prototype.iand = function iand (num) { assert((this.negative | num.negative) === 0); return this.iuand(num); }; // And `num` with `this` BN.prototype.and = function and (num) { if (this.length > num.length) return this.clone().iand(num); return num.clone().iand(this); }; BN.prototype.uand = function uand (num) { if (this.length > num.length) return this.clone().iuand(num); return num.clone().iuand(this); }; // Xor `num` with `this` in-place BN.prototype.iuxor = function iuxor (num) { // a.length > b.length var a; var b; if (this.length > num.length) { a = this; b = num; } else { a = num; b = this; } for (var i = 0; i < b.length; i++) { this.words[i] = a.words[i] ^ b.words[i]; } if (this !== a) { for (; i < a.length; i++) { this.words[i] = a.words[i]; } } this.length = a.length; return this._strip(); }; BN.prototype.ixor = function ixor (num) { assert((this.negative | num.negative) === 0); return this.iuxor(num); }; // Xor `num` with `this` BN.prototype.xor = function xor (num) { if (this.length > num.length) return this.clone().ixor(num); return num.clone().ixor(this); }; BN.prototype.uxor = function uxor (num) { if (this.length > num.length) return this.clone().iuxor(num); return num.clone().iuxor(this); }; // Not ``this`` with ``width`` bitwidth BN.prototype.inotn = function inotn (width) { assert(typeof width === 'number' && width >= 0); var bytesNeeded = Math.ceil(width / 26) | 0; var bitsLeft = width % 26; // Extend the buffer with leading zeroes this._expand(bytesNeeded); if (bitsLeft > 0) { bytesNeeded--; } // Handle complete words for (var i = 0; i < bytesNeeded; i++) { this.words[i] = ~this.words[i] & 0x3ffffff; } // Handle the residue if (bitsLeft > 0) { this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft)); } // And remove leading zeroes return this._strip(); }; BN.prototype.notn = function notn (width) { return this.clone().inotn(width); }; // Set `bit` of `this` BN.prototype.setn = function setn (bit, val) { assert(typeof bit === 'number' && bit >= 0); var off = (bit / 26) | 0; var wbit = bit % 26; this._expand(off + 1); if (val) { this.words[off] = this.words[off] | (1 << wbit); } else { this.words[off] = this.words[off] & ~(1 << wbit); } return this._strip(); }; // Add `num` to `this` in-place BN.prototype.iadd = function iadd (num) { var r; // negative + positive if (this.negative !== 0 && num.negative === 0) { this.negative = 0; r = this.isub(num); this.negative ^= 1; return this._normSign(); // positive + negative } else if (this.negative === 0 && num.negative !== 0) { num.negative = 0; r = this.isub(num); num.negative = 1; return r._normSign(); } // a.length > b.length var a, b; if (this.length > num.length) { a = this; b = num; } else { a = num; b = this; } var carry = 0; for (var i = 0; i < b.length; i++) { r = (a.words[i] | 0) + (b.words[i] | 0) + carry; this.words[i] = r & 0x3ffffff; carry = r >>> 26; } for (; carry !== 0 && i < a.length; i++) { r = (a.words[i] | 0) + carry; this.words[i] = r & 0x3ffffff; carry = r >>> 26; } this.length = a.length; if (carry !== 0) { this.words[this.length] = carry; this.length++; // Copy the rest of the words } else if (a !== this) { for (; i < a.length; i++) { this.words[i] = a.words[i]; } } return this; }; // Add `num` to `this` BN.prototype.add = function add (num) { var res; if (num.negative !== 0 && this.negative === 0) { num.negative = 0; res = this.sub(num); num.negative ^= 1; return res; } else if (num.negative === 0 && this.negative !== 0) { this.negative = 0; res = num.sub(this); this.negative = 1; return res; } if (this.length > num.length) return this.clone().iadd(num); return num.clone().iadd(this); }; // Subtract `num` from `this` in-place BN.prototype.isub = function isub (num) { // this - (-num) = this + num if (num.negative !== 0) { num.negative = 0; var r = this.iadd(num); num.negative = 1; return r._normSign(); // -this - num = -(this + num) } else if (this.negative !== 0) { this.negative = 0; this.iadd(num); this.negative = 1; return this._normSign(); } // At this point both numbers are positive var cmp = this.cmp(num); // Optimization - zeroify if (cmp === 0) { this.negative = 0; this.length = 1; this.words[0] = 0; return this; } // a > b var a, b; if (cmp > 0) { a = this; b = num; } else { a = num; b = this; } var carry = 0; for (var i = 0; i < b.length; i++) { r = (a.words[i] | 0) - (b.words[i] | 0) + carry; carry = r >> 26; this.words[i] = r & 0x3ffffff; } for (; carry !== 0 && i < a.length; i++) { r = (a.words[i] | 0) + carry; carry = r >> 26; this.words[i] = r & 0x3ffffff; } // Copy rest of the words if (carry === 0 && i < a.length && a !== this) { for (; i < a.length; i++) { this.words[i] = a.words[i]; } } this.length = Math.max(this.length, i); if (a !== this) { this.negative = 1; } return this._strip(); }; // Subtract `num` from `this` BN.prototype.sub = function sub (num) { return this.clone().isub(num); }; function smallMulTo (self, num, out) { out.negative = num.negative ^ self.negative; var len = (self.length + num.length) | 0; out.length = len; len = (len - 1) | 0; // Peel one iteration (compiler can't do it, because of code complexity) var a = self.words[0] | 0; var b = num.words[0] | 0; var r = a * b; var lo = r & 0x3ffffff; var carry = (r / 0x4000000) | 0; out.words[0] = lo; for (var k = 1; k < len; k++) { // Sum all words with the same `i + j = k` and accumulate `ncarry`, // note that ncarry could be >= 0x3ffffff var ncarry = carry >>> 26; var rword = carry & 0x3ffffff; var maxJ = Math.min(k, num.length - 1); for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { var i = (k - j) | 0; a = self.words[i] | 0; b = num.words[j] | 0; r = a * b + rword; ncarry += (r / 0x4000000) | 0; rword = r & 0x3ffffff; } out.words[k] = rword | 0; carry = ncarry | 0; } if (carry !== 0) { out.words[k] = carry | 0; } else { out.length--; } return out._strip(); } // TODO(indutny): it may be reasonable to omit it for users who don't need // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit // multiplication (like elliptic secp256k1). var comb10MulTo = function comb10MulTo (self, num, out) { var a = self.words; var b = num.words; var o = out.words; var c = 0; var lo; var mid; var hi; var a0 = a[0] | 0; var al0 = a0 & 0x1fff; var ah0 = a0 >>> 13; var a1 = a[1] | 0; var al1 = a1 & 0x1fff; var ah1 = a1 >>> 13; var a2 = a[2] | 0; var al2 = a2 & 0x1fff; var ah2 = a2 >>> 13; var a3 = a[3] | 0; var al3 = a3 & 0x1fff; var ah3 = a3 >>> 13; var a4 = a[4] | 0; var al4 = a4 & 0x1fff; var ah4 = a4 >>> 13; var a5 = a[5] | 0; var al5 = a5 & 0x1fff; var ah5 = a5 >>> 13; var a6 = a[6] | 0; var al6 = a6 & 0x1fff; var ah6 = a6 >>> 13; var a7 = a[7] | 0; var al7 = a7 & 0x1fff; var ah7 = a7 >>> 13; var a8 = a[8] | 0; var al8 = a8 & 0x1fff; var ah8 = a8 >>> 13; var a9 = a[9] | 0; var al9 = a9 & 0x1fff; var ah9 = a9 >>> 13; var b0 = b[0] | 0; var bl0 = b0 & 0x1fff; var bh0 = b0 >>> 13; var b1 = b[1] | 0; var bl1 = b1 & 0x1fff; var bh1 = b1 >>> 13; var b2 = b[2] | 0; var bl2 = b2 & 0x1fff; var bh2 = b2 >>> 13; var b3 = b[3] | 0; var bl3 = b3 & 0x1fff; var bh3 = b3 >>> 13; var b4 = b[4] | 0; var bl4 = b4 & 0x1fff; var bh4 = b4 >>> 13; var b5 = b[5] | 0; var bl5 = b5 & 0x1fff; var bh5 = b5 >>> 13; var b6 = b[6] | 0; var bl6 = b6 & 0x1fff; var bh6 = b6 >>> 13; var b7 = b[7] | 0; var bl7 = b7 & 0x1fff; var bh7 = b7 >>> 13; var b8 = b[8] | 0; var bl8 = b8 & 0x1fff; var bh8 = b8 >>> 13; var b9 = b[9] | 0; var bl9 = b9 & 0x1fff; var bh9 = b9 >>> 13; out.negative = self.negative ^ num.negative; out.length = 19; /* k = 0 */ lo = Math.imul(al0, bl0); mid = Math.imul(al0, bh0); mid = (mid + Math.imul(ah0, bl0)) | 0; hi = Math.imul(ah0, bh0); var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0; w0 &= 0x3ffffff; /* k = 1 */ lo = Math.imul(al1, bl0); mid = Math.imul(al1, bh0); mid = (mid + Math.imul(ah1, bl0)) | 0; hi = Math.imul(ah1, bh0); lo = (lo + Math.imul(al0, bl1)) | 0; mid = (mid + Math.imul(al0, bh1)) | 0; mid = (mid + Math.imul(ah0, bl1)) | 0; hi = (hi + Math.imul(ah0, bh1)) | 0; var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0; w1 &= 0x3ffffff; /* k = 2 */ lo = Math.imul(al2, bl0); mid = Math.imul(al2, bh0); mid = (mid + Math.imul(ah2, bl0)) | 0; hi = Math.imul(ah2, bh0); lo = (lo + Math.imul(al1, bl1)) | 0; mid = (mid + Math.imul(al1, bh1)) | 0; mid = (mid + Math.imul(ah1, bl1)) | 0; hi = (hi + Math.imul(ah1, bh1)) | 0; lo = (lo + Math.imul(al0, bl2)) | 0; mid = (mid + Math.imul(al0, bh2)) | 0; mid = (mid + Math.imul(ah0, bl2)) | 0; hi = (hi + Math.imul(ah0, bh2)) | 0; var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0; w2 &= 0x3ffffff; /* k = 3 */ lo = Math.imul(al3, bl0); mid = Math.imul(al3, bh0); mid = (mid + Math.imul(ah3, bl0)) | 0; hi = Math.imul(ah3, bh0); lo = (lo + Math.imul(al2, bl1)) | 0; mid = (mid + Math.imul(al2, bh1)) | 0; mid = (mid + Math.imul(ah2, bl1)) | 0; hi = (hi + Math.imul(ah2, bh1)) | 0; lo = (lo + Math.imul(al1, bl2)) | 0; mid = (mid + Math.imul(al1, bh2)) | 0; mid = (mid + Math.imul(ah1, bl2)) | 0; hi = (hi + Math.imul(ah1, bh2)) | 0; lo = (lo + Math.imul(al0, bl3)) | 0; mid = (mid + Math.imul(al0, bh3)) | 0; mid = (mid + Math.imul(ah0, bl3)) | 0; hi = (hi + Math.imul(ah0, bh3)) | 0; var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0; w3 &= 0x3ffffff; /* k = 4 */ lo = Math.imul(al4, bl0); mid = Math.imul(al4, bh0); mid = (mid + Math.imul(ah4, bl0)) | 0; hi = Math.imul(ah4, bh0); lo = (lo + Math.imul(al3, bl1)) | 0; mid = (mid + Math.imul(al3, bh1)) | 0; mid = (mid + Math.imul(ah3, bl1)) | 0; hi = (hi + Math.imul(ah3, bh1)) | 0; lo = (lo + Math.imul(al2, bl2)) | 0; mid = (mid + Math.imul(al2, bh2)) | 0; mid = (mid + Math.imul(ah2, bl2)) | 0; hi = (hi + Math.imul(ah2, bh2)) | 0; lo = (lo + Math.imul(al1, bl3)) | 0; mid = (mid + Math.imul(al1, bh3)) | 0; mid = (mid + Math.imul(ah1, bl3)) | 0; hi = (hi + Math.imul(ah1, bh3)) | 0; lo = (lo + Math.imul(al0, bl4)) | 0; mid = (mid + Math.imul(al0, bh4)) | 0; mid = (mid + Math.imul(ah0, bl4)) | 0; hi = (hi + Math.imul(ah0, bh4)) | 0; var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0; w4 &= 0x3ffffff; /* k = 5 */ lo = Math.imul(al5, bl0); mid = Math.imul(al5, bh0); mid = (mid + Math.imul(ah5, bl0)) | 0; hi = Math.imul(ah5, bh0); lo = (lo + Math.imul(al4, bl1)) | 0; mid = (mid + Math.imul(al4, bh1)) | 0; mid = (mid + Math.imul(ah4, bl1)) | 0; hi = (hi + Math.imul(ah4, bh1)) | 0; lo = (lo + Math.imul(al3, bl2)) | 0; mid = (mid + Math.imul(al3, bh2)) | 0; mid = (mid + Math.imul(ah3, bl2)) | 0; hi = (hi + Math.imul(ah3, bh2)) | 0; lo = (lo + Math.imul(al2, bl3)) | 0; mid = (mid + Math.imul(al2, bh3)) | 0; mid = (mid + Math.imul(ah2, bl3)) | 0; hi = (hi + Math.imul(ah2, bh3)) | 0; lo = (lo + Math.imul(al1, bl4)) | 0; mid = (mid + Math.imul(al1, bh4)) | 0; mid = (mid + Math.imul(ah1, bl4)) | 0; hi = (hi + Math.imul(ah1, bh4)) | 0; lo = (lo + Math.imul(al0, bl5)) | 0; mid = (mid + Math.imul(al0, bh5)) | 0; mid = (mid + Math.imul(ah0, bl5)) | 0; hi = (hi + Math.imul(ah0, bh5)) | 0; var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0; w5 &= 0x3ffffff; /* k = 6 */ lo = Math.imul(al6, bl0); mid = Math.imul(al6, bh0); mid = (mid + Math.imul(ah6, bl0)) | 0; hi = Math.imul(ah6, bh0); lo = (lo + Math.imul(al5, bl1)) | 0; mid = (mid + Math.imul(al5, bh1)) | 0; mid = (mid + Math.imul(ah5, bl1)) | 0; hi = (hi + Math.imul(ah5, bh1)) | 0; lo = (lo + Math.imul(al4, bl2)) | 0; mid = (mid + Math.imul(al4, bh2)) | 0; mid = (mid + Math.imul(ah4, bl2)) | 0; hi = (hi + Math.imul(ah4, bh2)) | 0; lo = (lo + Math.imul(al3, bl3)) | 0; mid = (mid + Math.imul(al3, bh3)) | 0; mid = (mid + Math.imul(ah3, bl3)) | 0; hi = (hi + Math.imul(ah3, bh3)) | 0; lo = (lo + Math.imul(al2, bl4)) | 0; mid = (mid + Math.imul(al2, bh4)) | 0; mid = (mid + Math.imul(ah2, bl4)) | 0; hi = (hi + Math.imul(ah2, bh4)) | 0; lo = (lo + Math.imul(al1, bl5)) | 0; mid = (mid + Math.imul(al1, bh5)) | 0; mid = (mid + Math.imul(ah1, bl5)) | 0; hi = (hi + Math.imul(ah1, bh5)) | 0; lo = (lo + Math.imul(al0, bl6)) | 0; mid = (mid + Math.imul(al0, bh6)) | 0; mid = (mid + Math.imul(ah0, bl6)) | 0; hi = (hi + Math.imul(ah0, bh6)) | 0; var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0; w6 &= 0x3ffffff; /* k = 7 */ lo = Math.imul(al7, bl0); mid = Math.imul(al7, bh0); mid = (mid + Math.imul(ah7, bl0)) | 0; hi = Math.imul(ah7, bh0); lo = (lo + Math.imul(al6, bl1)) | 0; mid = (mid + Math.imul(al6, bh1)) | 0; mid = (mid + Math.imul(ah6, bl1)) | 0; hi = (hi + Math.imul(ah6, bh1)) | 0; lo = (lo + Math.imul(al5, bl2)) | 0; mid = (mid + Math.imul(al5, bh2)) | 0; mid = (mid + Math.imul(ah5, bl2)) | 0; hi = (hi + Math.imul(ah5, bh2)) | 0; lo = (lo + Math.imul(al4, bl3)) | 0; mid = (mid + Math.imul(al4, bh3)) | 0; mid = (mid + Math.imul(ah4, bl3)) | 0; hi = (hi + Math.imul(ah4, bh3)) | 0; lo = (lo + Math.imul(al3, bl4)) | 0; mid = (mid + Math.imul(al3, bh4)) | 0; mid = (mid + Math.imul(ah3, bl4)) | 0; hi = (hi + Math.imul(ah3, bh4)) | 0; lo = (lo + Math.imul(al2, bl5)) | 0; mid = (mid + Math.imul(al2, bh5)) | 0; mid = (mid + Math.imul(ah2, bl5)) | 0; hi = (hi + Math.imul(ah2, bh5)) | 0; lo = (lo + Math.imul(al1, bl6)) | 0; mid = (mid + Math.imul(al1, bh6)) | 0; mid = (mid + Math.imul(ah1, bl6)) | 0; hi = (hi + Math.imul(ah1, bh6)) | 0; lo = (lo + Math.imul(al0, bl7)) | 0; mid = (mid + Math.imul(al0, bh7)) | 0; mid = (mid + Math.imul(ah0, bl7)) | 0; hi = (hi + Math.imul(ah0, bh7)) | 0; var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0; w7 &= 0x3ffffff; /* k = 8 */ lo = Math.imul(al8, bl0); mid = Math.imul(al8, bh0); mid = (mid + Math.imul(ah8, bl0)) | 0; hi = Math.imul(ah8, bh0); lo = (lo + Math.imul(al7, bl1)) | 0; mid = (mid + Math.imul(al7, bh1)) | 0; mid = (mid + Math.imul(ah7, bl1)) | 0; hi = (hi + Math.imul(ah7, bh1)) | 0; lo = (lo + Math.imul(al6, bl2)) | 0; mid = (mid + Math.imul(al6, bh2)) | 0; mid = (mid + Math.imul(ah6, bl2)) | 0; hi = (hi + Math.imul(ah6, bh2)) | 0; lo = (lo + Math.imul(al5, bl3)) | 0; mid = (mid + Math.imul(al5, bh3)) | 0; mid = (mid + Math.imul(ah5, bl3)) | 0; hi = (hi + Math.imul(ah5, bh3)) | 0; lo = (lo + Math.imul(al4, bl4)) | 0; mid = (mid + Math.imul(al4, bh4)) | 0; mid = (mid + Math.imul(ah4, bl4)) | 0; hi = (hi + Math.imul(ah4, bh4)) | 0; lo = (lo + Math.imul(al3, bl5)) | 0; mid = (mid + Math.imul(al3, bh5)) | 0; mid = (mid + Math.imul(ah3, bl5)) | 0; hi = (hi + Math.imul(ah3, bh5)) | 0; lo = (lo + Math.imul(al2, bl6)) | 0; mid = (mid + Math.imul(al2, bh6)) | 0; mid = (mid + Math.imul(ah2, bl6)) | 0; hi = (hi + Math.imul(ah2, bh6)) | 0; lo = (lo + Math.imul(al1, bl7)) | 0; mid = (mid + Math.imul(al1, bh7)) | 0; mid = (mid + Math.imul(ah1, bl7)) | 0; hi = (hi + Math.imul(ah1, bh7)) | 0; lo = (lo + Math.imul(al0, bl8)) | 0; mid = (mid + Math.imul(al0, bh8)) | 0; mid = (mid + Math.imul(ah0, bl8)) | 0; hi = (hi + Math.imul(ah0, bh8)) | 0; var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0; w8 &= 0x3ffffff; /* k = 9 */ lo = Math.imul(al9, bl0); mid = Math.imul(al9, bh0); mid = (mid + Math.imul(ah9, bl0)) | 0; hi = Math.imul(ah9, bh0); lo = (lo + Math.imul(al8, bl1)) | 0; mid = (mid + Math.imul(al8, bh1)) | 0; mid = (mid + Math.imul(ah8, bl1)) | 0; hi = (hi + Math.imul(ah8, bh1)) | 0; lo = (lo + Math.imul(al7, bl2)) | 0; mid = (mid + Math.imul(al7, bh2)) | 0; mid = (mid + Math.imul(ah7, bl2)) | 0; hi = (hi + Math.imul(ah7, bh2)) | 0; lo = (lo + Math.imul(al6, bl3)) | 0; mid = (mid + Math.imul(al6, bh3)) | 0; mid = (mid + Math.imul(ah6, bl3)) | 0; hi = (hi + Math.imul(ah6, bh3)) | 0; lo = (lo + Math.imul(al5, bl4)) | 0; mid = (mid + Math.imul(al5, bh4)) | 0; mid = (mid + Math.imul(ah5, bl4)) | 0; hi = (hi + Math.imul(ah5, bh4)) | 0; lo = (lo + Math.imul(al4, bl5)) | 0; mid = (mid + Math.imul(al4, bh5)) | 0; mid = (mid + Math.imul(ah4, bl5)) | 0; hi = (hi + Math.imul(ah4, bh5)) | 0; lo = (lo + Math.imul(al3, bl6)) | 0; mid = (mid + Math.imul(al3, bh6)) | 0; mid = (mid + Math.imul(ah3, bl6)) | 0; hi = (hi + Math.imul(ah3, bh6)) | 0; lo = (lo + Math.imul(al2, bl7)) | 0; mid = (mid + Math.imul(al2, bh7)) | 0; mid = (mid + Math.imul(ah2, bl7)) | 0; hi = (hi + Math.imul(ah2, bh7)) | 0; lo = (lo + Math.imul(al1, bl8)) | 0; mid = (mid + Math.imul(al1, bh8)) | 0; mid = (mid + Math.imul(ah1, bl8)) | 0; hi = (hi + Math.imul(ah1, bh8)) | 0; lo = (lo + Math.imul(al0, bl9)) | 0; mid = (mid + Math.imul(al0, bh9)) | 0; mid = (mid + Math.imul(ah0, bl9)) | 0; hi = (hi + Math.imul(ah0, bh9)) | 0; var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0; w9 &= 0x3ffffff; /* k = 10 */ lo = Math.imul(al9, bl1); mid = Math.imul(al9, bh1); mid = (mid + Math.imul(ah9, bl1)) | 0; hi = Math.imul(ah9, bh1); lo = (lo + Math.imul(al8, bl2)) | 0; mid = (mid + Math.imul(al8, bh2)) | 0; mid = (mid + Math.imul(ah8, bl2)) | 0; hi = (hi + Math.imul(ah8, bh2)) | 0; lo = (lo + Math.imul(al7, bl3)) | 0; mid = (mid + Math.imul(al7, bh3)) | 0; mid = (mid + Math.imul(ah7, bl3)) | 0; hi = (hi + Math.imul(ah7, bh3)) | 0; lo = (lo + Math.imul(al6, bl4)) | 0; mid = (mid + Math.imul(al6, bh4)) | 0; mid = (mid + Math.imul(ah6, bl4)) | 0; hi = (hi + Math.imul(ah6, bh4)) | 0; lo = (lo + Math.imul(al5, bl5)) | 0; mid = (mid + Math.imul(al5, bh5)) | 0; mid = (mid + Math.imul(ah5, bl5)) | 0; hi = (hi + Math.imul(ah5, bh5)) | 0; lo = (lo + Math.imul(al4, bl6)) | 0; mid = (mid + Math.imul(al4, bh6)) | 0; mid = (mid + Math.imul(ah4, bl6)) | 0; hi = (hi + Math.imul(ah4, bh6)) | 0; lo = (lo + Math.imul(al3, bl7)) | 0; mid = (mid + Math.imul(al3, bh7)) | 0; mid = (mid + Math.imul(ah3, bl7)) | 0; hi = (hi + Math.imul(ah3, bh7)) | 0; lo = (lo + Math.imul(al2, bl8)) | 0; mid = (mid + Math.imul(al2, bh8)) | 0; mid = (mid + Math.imul(ah2, bl8)) | 0; hi = (hi + Math.imul(ah2, bh8)) | 0; lo = (lo + Math.imul(al1, bl9)) | 0; mid = (mid + Math.imul(al1, bh9)) | 0; mid = (mid + Math.imul(ah1, bl9)) | 0; hi = (hi + Math.imul(ah1, bh9)) | 0; var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0; w10 &= 0x3ffffff; /* k = 11 */ lo = Math.imul(al9, bl2); mid = Math.imul(al9, bh2); mid = (mid + Math.imul(ah9, bl2)) | 0; hi = Math.imul(ah9, bh2); lo = (lo + Math.imul(al8, bl3)) | 0; mid = (mid + Math.imul(al8, bh3)) | 0; mid = (mid + Math.imul(ah8, bl3)) | 0; hi = (hi + Math.imul(ah8, bh3)) | 0; lo = (lo + Math.imul(al7, bl4)) | 0; mid = (mid + Math.imul(al7, bh4)) | 0; mid = (mid + Math.imul(ah7, bl4)) | 0; hi = (hi + Math.imul(ah7, bh4)) | 0; lo = (lo + Math.imul(al6, bl5)) | 0; mid = (mid + Math.imul(al6, bh5)) | 0; mid = (mid + Math.imul(ah6, bl5)) | 0; hi = (hi + Math.imul(ah6, bh5)) | 0; lo = (lo + Math.imul(al5, bl6)) | 0; mid = (mid + Math.imul(al5, bh6)) | 0; mid = (mid + Math.imul(ah5, bl6)) | 0; hi = (hi + Math.imul(ah5, bh6)) | 0; lo = (lo + Math.imul(al4, bl7)) | 0; mid = (mid + Math.imul(al4, bh7)) | 0; mid = (mid + Math.imul(ah4, bl7)) | 0; hi = (hi + Math.imul(ah4, bh7)) | 0; lo = (lo + Math.imul(al3, bl8)) | 0; mid = (mid + Math.imul(al3, bh8)) | 0; mid = (mid + Math.imul(ah3, bl8)) | 0; hi = (hi + Math.imul(ah3, bh8)) | 0; lo = (lo + Math.imul(al2, bl9)) | 0; mid = (mid + Math.imul(al2, bh9)) | 0; mid = (mid + Math.imul(ah2, bl9)) | 0; hi = (hi + Math.imul(ah2, bh9)) | 0; var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0; w11 &= 0x3ffffff; /* k = 12 */ lo = Math.imul(al9, bl3); mid = Math.imul(al9, bh3); mid = (mid + Math.imul(ah9, bl3)) | 0; hi = Math.imul(ah9, bh3); lo = (lo + Math.imul(al8, bl4)) | 0; mid = (mid + Math.imul(al8, bh4)) | 0; mid = (mid + Math.imul(ah8, bl4)) | 0; hi = (hi + Math.imul(ah8, bh4)) | 0; lo = (lo + Math.imul(al7, bl5)) | 0; mid = (mid + Math.imul(al7, bh5)) | 0; mid = (mid + Math.imul(ah7, bl5)) | 0; hi = (hi + Math.imul(ah7, bh5)) | 0; lo = (lo + Math.imul(al6, bl6)) | 0; mid = (mid + Math.imul(al6, bh6)) | 0; mid = (mid + Math.imul(ah6, bl6)) | 0; hi = (hi + Math.imul(ah6, bh6)) | 0; lo = (lo + Math.imul(al5, bl7)) | 0; mid = (mid + Math.imul(al5, bh7)) | 0; mid = (mid + Math.imul(ah5, bl7)) | 0; hi = (hi + Math.imul(ah5, bh7)) | 0; lo = (lo + Math.imul(al4, bl8)) | 0; mid = (mid + Math.imul(al4, bh8)) | 0; mid = (mid + Math.imul(ah4, bl8)) | 0; hi = (hi + Math.imul(ah4, bh8)) | 0; lo = (lo + Math.imul(al3, bl9)) | 0; mid = (mid + Math.imul(al3, bh9)) | 0; mid = (mid + Math.imul(ah3, bl9)) | 0; hi = (hi + Math.imul(ah3, bh9)) | 0; var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0; w12 &= 0x3ffffff; /* k = 13 */ lo = Math.imul(al9, bl4); mid = Math.imul(al9, bh4); mid = (mid + Math.imul(ah9, bl4)) | 0; hi = Math.imul(ah9, bh4); lo = (lo + Math.imul(al8, bl5)) | 0; mid = (mid + Math.imul(al8, bh5)) | 0; mid = (mid + Math.imul(ah8, bl5)) | 0; hi = (hi + Math.imul(ah8, bh5)) | 0; lo = (lo + Math.imul(al7, bl6)) | 0; mid = (mid + Math.imul(al7, bh6)) | 0; mid = (mid + Math.imul(ah7, bl6)) | 0; hi = (hi + Math.imul(ah7, bh6)) | 0; lo = (lo + Math.imul(al6, bl7)) | 0; mid = (mid + Math.imul(al6, bh7)) | 0; mid = (mid + Math.imul(ah6, bl7)) | 0; hi = (hi + Math.imul(ah6, bh7)) | 0; lo = (lo + Math.imul(al5, bl8)) | 0; mid = (mid + Math.imul(al5, bh8)) | 0; mid = (mid + Math.imul(ah5, bl8)) | 0; hi = (hi + Math.imul(ah5, bh8)) | 0; lo = (lo + Math.imul(al4, bl9)) | 0; mid = (mid + Math.imul(al4, bh9)) | 0; mid = (mid + Math.imul(ah4, bl9)) | 0; hi = (hi + Math.imul(ah4, bh9)) | 0; var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0; w13 &= 0x3ffffff; /* k = 14 */ lo = Math.imul(al9, bl5); mid = Math.imul(al9, bh5); mid = (mid + Math.imul(ah9, bl5)) | 0; hi = Math.imul(ah9, bh5); lo = (lo + Math.imul(al8, bl6)) | 0; mid = (mid + Math.imul(al8, bh6)) | 0; mid = (mid + Math.imul(ah8, bl6)) | 0; hi = (hi + Math.imul(ah8, bh6)) | 0; lo = (lo + Math.imul(al7, bl7)) | 0; mid = (mid + Math.imul(al7, bh7)) | 0; mid = (mid + Math.imul(ah7, bl7)) | 0; hi = (hi + Math.imul(ah7, bh7)) | 0; lo = (lo + Math.imul(al6, bl8)) | 0; mid = (mid + Math.imul(al6, bh8)) | 0; mid = (mid + Math.imul(ah6, bl8)) | 0; hi = (hi + Math.imul(ah6, bh8)) | 0; lo = (lo + Math.imul(al5, bl9)) | 0; mid = (mid + Math.imul(al5, bh9)) | 0; mid = (mid + Math.imul(ah5, bl9)) | 0; hi = (hi + Math.imul(ah5, bh9)) | 0; var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0; w14 &= 0x3ffffff; /* k = 15 */ lo = Math.imul(al9, bl6); mid = Math.imul(al9, bh6); mid = (mid + Math.imul(ah9, bl6)) | 0; hi = Math.imul(ah9, bh6); lo = (lo + Math.imul(al8, bl7)) | 0; mid = (mid + Math.imul(al8, bh7)) | 0; mid = (mid + Math.imul(ah8, bl7)) | 0; hi = (hi + Math.imul(ah8, bh7)) | 0; lo = (lo + Math.imul(al7, bl8)) | 0; mid = (mid + Math.imul(al7, bh8)) | 0; mid = (mid + Math.imul(ah7, bl8)) | 0; hi = (hi + Math.imul(ah7, bh8)) | 0; lo = (lo + Math.imul(al6, bl9)) | 0; mid = (mid + Math.imul(al6, bh9)) | 0; mid = (mid + Math.imul(ah6, bl9)) | 0; hi = (hi + Math.imul(ah6, bh9)) | 0; var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0; w15 &= 0x3ffffff; /* k = 16 */ lo = Math.imul(al9, bl7); mid = Math.imul(al9, bh7); mid = (mid + Math.imul(ah9, bl7)) | 0; hi = Math.imul(ah9, bh7); lo = (lo + Math.imul(al8, bl8)) | 0; mid = (mid + Math.imul(al8, bh8)) | 0; mid = (mid + Math.imul(ah8, bl8)) | 0; hi = (hi + Math.imul(ah8, bh8)) | 0; lo = (lo + Math.imul(al7, bl9)) | 0; mid = (mid + Math.imul(al7, bh9)) | 0; mid = (mid + Math.imul(ah7, bl9)) | 0; hi = (hi + Math.imul(ah7, bh9)) | 0; var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0; w16 &= 0x3ffffff; /* k = 17 */ lo = Math.imul(al9, bl8); mid = Math.imul(al9, bh8); mid = (mid + Math.imul(ah9, bl8)) | 0; hi = Math.imul(ah9, bh8); lo = (lo + Math.imul(al8, bl9)) | 0; mid = (mid + Math.imul(al8, bh9)) | 0; mid = (mid + Math.imul(ah8, bl9)) | 0; hi = (hi + Math.imul(ah8, bh9)) | 0; var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0; w17 &= 0x3ffffff; /* k = 18 */ lo = Math.imul(al9, bl9); mid = Math.imul(al9, bh9); mid = (mid + Math.imul(ah9, bl9)) | 0; hi = Math.imul(ah9, bh9); var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0; w18 &= 0x3ffffff; o[0] = w0; o[1] = w1; o[2] = w2; o[3] = w3; o[4] = w4; o[5] = w5; o[6] = w6; o[7] = w7; o[8] = w8; o[9] = w9; o[10] = w10; o[11] = w11; o[12] = w12; o[13] = w13; o[14] = w14; o[15] = w15; o[16] = w16; o[17] = w17; o[18] = w18; if (c !== 0) { o[19] = c; out.length++; } return out; }; // Polyfill comb if (!Math.imul) { comb10MulTo = smallMulTo; } function bigMulTo (self, num, out) { out.negative = num.negative ^ self.negative; out.length = self.length + num.length; var carry = 0; var hncarry = 0; for (var k = 0; k < out.length - 1; k++) { // Sum all words with the same `i + j = k` and accumulate `ncarry`, // note that ncarry could be >= 0x3ffffff var ncarry = hncarry; hncarry = 0; var rword = carry & 0x3ffffff; var maxJ = Math.min(k, num.length - 1); for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { var i = k - j; var a = self.words[i] | 0; var b = num.words[j] | 0; var r = a * b; var lo = r & 0x3ffffff; ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0; lo = (lo + rword) | 0; rword = lo & 0x3ffffff; ncarry = (ncarry + (lo >>> 26)) | 0; hncarry += ncarry >>> 26; ncarry &= 0x3ffffff; } out.words[k] = rword; carry = ncarry; ncarry = hncarry; } if (carry !== 0) { out.words[k] = carry; } else { out.length--; } return out._strip(); } function jumboMulTo (self, num, out) { // Temporary disable, see https://github.com/indutny/bn.js/issues/211 // var fftm = new FFTM(); // return fftm.mulp(self, num, out); return bigMulTo(self, num, out); } BN.prototype.mulTo = function mulTo (num, out) { var res; var len = this.length + num.length; if (this.length === 10 && num.length === 10) { res = comb10MulTo(this, num, out); } else if (len < 63) { res = smallMulTo(this, num, out); } else if (len < 1024) { res = bigMulTo(this, num, out); } else { res = jumboMulTo(this, num, out); } return res; }; // Cooley-Tukey algorithm for FFT // slightly revisited to rely on looping instead of recursion function FFTM (x, y) { this.x = x; this.y = y; } FFTM.prototype.makeRBT = function makeRBT (N) { var t = new Array(N); var l = BN.prototype._countBits(N) - 1; for (var i = 0; i < N; i++) { t[i] = this.revBin(i, l, N); } return t; }; // Returns binary-reversed representation of `x` FFTM.prototype.revBin = function revBin (x, l, N) { if (x === 0 || x === N - 1) return x; var rb = 0; for (var i = 0; i < l; i++) { rb |= (x & 1) << (l - i - 1); x >>= 1; } return rb; }; // Performs "tweedling" phase, therefore 'emulating' // behaviour of the recursive algorithm FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) { for (var i = 0; i < N; i++) { rtws[i] = rws[rbt[i]]; itws[i] = iws[rbt[i]]; } }; FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) { this.permute(rbt, rws, iws, rtws, itws, N); for (var s = 1; s < N; s <<= 1) { var l = s << 1; var rtwdf = Math.cos(2 * Math.PI / l); var itwdf = Math.sin(2 * Math.PI / l); for (var p = 0; p < N; p += l) { var rtwdf_ = rtwdf; var itwdf_ = itwdf; for (var j = 0; j < s; j++) { var re = rtws[p + j]; var ie = itws[p + j]; var ro = rtws[p + j + s]; var io = itws[p + j + s]; var rx = rtwdf_ * ro - itwdf_ * io; io = rtwdf_ * io + itwdf_ * ro; ro = rx; rtws[p + j] = re + ro; itws[p + j] = ie + io; rtws[p + j + s] = re - ro; itws[p + j + s] = ie - io; /* jshint maxdepth : false */ if (j !== l) { rx = rtwdf * rtwdf_ - itwdf * itwdf_; itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_; rtwdf_ = rx; } } } } }; FFTM.prototype.guessLen13b = function guessLen13b (n, m) { var N = Math.max(m, n) | 1; var odd = N & 1; var i = 0; for (N = N / 2 | 0; N; N = N >>> 1) { i++; } return 1 << i + 1 + odd; }; FFTM.prototype.conjugate = function conjugate (rws, iws, N) { if (N <= 1) return; for (var i = 0; i < N / 2; i++) { var t = rws[i]; rws[i] = rws[N - i - 1]; rws[N - i - 1] = t; t = iws[i]; iws[i] = -iws[N - i - 1]; iws[N - i - 1] = -t; } }; FFTM.prototype.normalize13b = function normalize13b (ws, N) { var carry = 0; for (var i = 0; i < N / 2; i++) { var w = Math.round(ws[2 * i + 1] / N) * 0x2000 + Math.round(ws[2 * i] / N) + carry; ws[i] = w & 0x3ffffff; if (w < 0x4000000) { carry = 0; } else { carry = w / 0x4000000 | 0; } } return ws; }; FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) { var carry = 0; for (var i = 0; i < len; i++) { carry = carry + (ws[i] | 0); rws[2 * i] = carry & 0x1fff; carry = carry >>> 13; rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13; } // Pad with zeroes for (i = 2 * len; i < N; ++i) { rws[i] = 0; } assert(carry === 0); assert((carry & ~0x1fff) === 0); }; FFTM.prototype.stub = function stub (N) { var ph = new Array(N); for (var i = 0; i < N; i++) { ph[i] = 0; } return ph; }; FFTM.prototype.mulp = function mulp (x, y, out) { var N = 2 * this.guessLen13b(x.length, y.length); var rbt = this.makeRBT(N); var _ = this.stub(N); var rws = new Array(N); var rwst = new Array(N); var iwst = new Array(N); var nrws = new Array(N); var nrwst = new Array(N); var niwst = new Array(N); var rmws = out.words; rmws.length = N; this.convert13b(x.words, x.length, rws, N); this.convert13b(y.words, y.length, nrws, N); this.transform(rws, _, rwst, iwst, N, rbt); this.transform(nrws, _, nrwst, niwst, N, rbt); for (var i = 0; i < N; i++) { var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i]; iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i]; rwst[i] = rx; } this.conjugate(rwst, iwst, N); this.transform(rwst, iwst, rmws, _, N, rbt); this.conjugate(rmws, _, N); this.normalize13b(rmws, N); out.negative = x.negative ^ y.negative; out.length = x.length + y.length; return out._strip(); }; // Multiply `this` by `num` BN.prototype.mul = function mul (num) { var out = new BN(null); out.words = new Array(this.length + num.length); return this.mulTo(num, out); }; // Multiply employing FFT BN.prototype.mulf = function mulf (num) { var out = new BN(null); out.words = new Array(this.length + num.length); return jumboMulTo(this, num, out); }; // In-place Multiplication BN.prototype.imul = function imul (num) { return this.clone().mulTo(num, this); }; BN.prototype.imuln = function imuln (num) { var isNegNum = num < 0; if (isNegNum) num = -num; assert(typeof num === 'number'); assert(num < 0x4000000); // Carry var carry = 0; for (var i = 0; i < this.length; i++) { var w = (this.words[i] | 0) * num; var lo = (w & 0x3ffffff) + (carry & 0x3ffffff); carry >>= 26; carry += (w / 0x4000000) | 0; // NOTE: lo is 27bit maximum carry += lo >>> 26; this.words[i] = lo & 0x3ffffff; } if (carry !== 0) { this.words[i] = carry; this.length++; } return isNegNum ? this.ineg() : this; }; BN.prototype.muln = function muln (num) { return this.clone().imuln(num); }; // `this` * `this` BN.prototype.sqr = function sqr () { return this.mul(this); }; // `this` * `this` in-place BN.prototype.isqr = function isqr () { return this.imul(this.clone()); }; // Math.pow(`this`, `num`) BN.prototype.pow = function pow (num) { var w = toBitArray(num); if (w.length === 0) return new BN(1); // Skip leading zeroes var res = this; for (var i = 0; i < w.length; i++, res = res.sqr()) { if (w[i] !== 0) break; } if (++i < w.length) { for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) { if (w[i] === 0) continue; res = res.mul(q); } } return res; }; // Shift-left in-place BN.prototype.iushln = function iushln (bits) { assert(typeof bits === 'number' && bits >= 0); var r = bits % 26; var s = (bits - r) / 26; var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r); var i; if (r !== 0) { var carry = 0; for (i = 0; i < this.length; i++) { var newCarry = this.words[i] & carryMask; var c = ((this.words[i] | 0) - newCarry) << r; this.words[i] = c | carry; carry = newCarry >>> (26 - r); } if (carry) { this.words[i] = carry; this.length++; } } if (s !== 0) { for (i = this.length - 1; i >= 0; i--) { this.words[i + s] = this.words[i]; } for (i = 0; i < s; i++) { this.words[i] = 0; } this.length += s; } return this._strip(); }; BN.prototype.ishln = function ishln (bits) { // TODO(indutny): implement me assert(this.negative === 0); return this.iushln(bits); }; // Shift-right in-place // NOTE: `hint` is a lowest bit before trailing zeroes // NOTE: if `extended` is present - it will be filled with destroyed bits BN.prototype.iushrn = function iushrn (bits, hint, extended) { assert(typeof bits === 'number' && bits >= 0); var h; if (hint) { h = (hint - (hint % 26)) / 26; } else { h = 0; } var r = bits % 26; var s = Math.min((bits - r) / 26, this.length); var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); var maskedWords = extended; h -= s; h = Math.max(0, h); // Extended mode, copy masked part if (maskedWords) { for (var i = 0; i < s; i++) { maskedWords.words[i] = this.words[i]; } maskedWords.length = s; } if (s === 0) { // No-op, we should not move anything at all } else if (this.length > s) { this.length -= s; for (i = 0; i < this.length; i++) { this.words[i] = this.words[i + s]; } } else { this.words[0] = 0; this.length = 1; } var carry = 0; for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) { var word = this.words[i] | 0; this.words[i] = (carry << (26 - r)) | (word >>> r); carry = word & mask; } // Push carried bits as a mask if (maskedWords && carry !== 0) { maskedWords.words[maskedWords.length++] = carry; } if (this.length === 0) { this.words[0] = 0; this.length = 1; } return this._strip(); }; BN.prototype.ishrn = function ishrn (bits, hint, extended) { // TODO(indutny): implement me assert(this.negative === 0); return this.iushrn(bits, hint, extended); }; // Shift-left BN.prototype.shln = function shln (bits) { return this.clone().ishln(bits); }; BN.prototype.ushln = function ushln (bits) { return this.clone().iushln(bits); }; // Shift-right BN.prototype.shrn = function shrn (bits) { return this.clone().ishrn(bits); }; BN.prototype.ushrn = function ushrn (bits) { return this.clone().iushrn(bits); }; // Test if n bit is set BN.prototype.testn = function testn (bit) { assert(typeof bit === 'number' && bit >= 0); var r = bit % 26; var s = (bit - r) / 26; var q = 1 << r; // Fast case: bit is much higher than all existing words if (this.length <= s) return false; // Check bit and return var w = this.words[s]; return !!(w & q); }; // Return only lowers bits of number (in-place) BN.prototype.imaskn = function imaskn (bits) { assert(typeof bits === 'number' && bits >= 0); var r = bits % 26; var s = (bits - r) / 26; assert(this.negative === 0, 'imaskn works only with positive numbers'); if (this.length <= s) { return this; } if (r !== 0) { s++; } this.length = Math.min(s, this.length); if (r !== 0) { var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); this.words[this.length - 1] &= mask; } return this._strip(); }; // Return only lowers bits of number BN.prototype.maskn = function maskn (bits) { return this.clone().imaskn(bits); }; // Add plain number `num` to `this` BN.prototype.iaddn = function iaddn (num) { assert(typeof num === 'number'); assert(num < 0x4000000); if (num < 0) return this.isubn(-num); // Possible sign change if (this.negative !== 0) { if (this.length === 1 && (this.words[0] | 0) <= num) { this.words[0] = num - (this.words[0] | 0); this.negative = 0; return this; } this.negative = 0; this.isubn(num); this.negative = 1; return this; } // Add without checks return this._iaddn(num); }; BN.prototype._iaddn = function _iaddn (num) { this.words[0] += num; // Carry for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) { this.words[i] -= 0x4000000; if (i === this.length - 1) { this.words[i + 1] = 1; } else { this.words[i + 1]++; } } this.length = Math.max(this.length, i + 1); return this; }; // Subtract plain number `num` from `this` BN.prototype.isubn = function isubn (num) { assert(typeof num === 'number'); assert(num < 0x4000000); if (num < 0) return this.iaddn(-num); if (this.negative !== 0) { this.negative = 0; this.iaddn(num); this.negative = 1; return this; } this.words[0] -= num; if (this.length === 1 && this.words[0] < 0) { this.words[0] = -this.words[0]; this.negative = 1; } else { // Carry for (var i = 0; i < this.length && this.words[i] < 0; i++) { this.words[i] += 0x4000000; this.words[i + 1] -= 1; } } return this._strip(); }; BN.prototype.addn = function addn (num) { return this.clone().iaddn(num); }; BN.prototype.subn = function subn (num) { return this.clone().isubn(num); }; BN.prototype.iabs = function iabs () { this.negative = 0; return this; }; BN.prototype.abs = function abs () { return this.clone().iabs(); }; BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) { var len = num.length + shift; var i; this._expand(len); var w; var carry = 0; for (i = 0; i < num.length; i++) { w = (this.words[i + shift] | 0) + carry; var right = (num.words[i] | 0) * mul; w -= right & 0x3ffffff; carry = (w >> 26) - ((right / 0x4000000) | 0); this.words[i + shift] = w & 0x3ffffff; } for (; i < this.length - shift; i++) { w = (this.words[i + shift] | 0) + carry; carry = w >> 26; this.words[i + shift] = w & 0x3ffffff; } if (carry === 0) return this._strip(); // Subtraction overflow assert(carry === -1); carry = 0; for (i = 0; i < this.length; i++) { w = -(this.words[i] | 0) + carry; carry = w >> 26; this.words[i] = w & 0x3ffffff; } this.negative = 1; return this._strip(); }; BN.prototype._wordDiv = function _wordDiv (num, mode) { var shift = this.length - num.length; var a = this.clone(); var b = num; // Normalize var bhi = b.words[b.length - 1] | 0; var bhiBits = this._countBits(bhi); shift = 26 - bhiBits; if (shift !== 0) { b = b.ushln(shift); a.iushln(shift); bhi = b.words[b.length - 1] | 0; } // Initialize quotient var m = a.length - b.length; var q; if (mode !== 'mod') { q = new BN(null); q.length = m + 1; q.words = new Array(q.length); for (var i = 0; i < q.length; i++) { q.words[i] = 0; } } var diff = a.clone()._ishlnsubmul(b, 1, m); if (diff.negative === 0) { a = diff; if (q) { q.words[m] = 1; } } for (var j = m - 1; j >= 0; j--) { var qj = (a.words[b.length + j] | 0) * 0x4000000 + (a.words[b.length + j - 1] | 0); // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max // (0x7ffffff) qj = Math.min((qj / bhi) | 0, 0x3ffffff); a._ishlnsubmul(b, qj, j); while (a.negative !== 0) { qj--; a.negative = 0; a._ishlnsubmul(b, 1, j); if (!a.isZero()) { a.negative ^= 1; } } if (q) { q.words[j] = qj; } } if (q) { q._strip(); } a._strip(); // Denormalize if (mode !== 'div' && shift !== 0) { a.iushrn(shift); } return { div: q || null, mod: a }; }; // NOTE: 1) `mode` can be set to `mod` to request mod only, // to `div` to request div only, or be absent to // request both div & mod // 2) `positive` is true if unsigned mod is requested BN.prototype.divmod = function divmod (num, mode, positive) { assert(!num.isZero()); if (this.isZero()) { return { div: new BN(0), mod: new BN(0) }; } var div, mod, res; if (this.negative !== 0 && num.negative === 0) { res = this.neg().divmod(num, mode); if (mode !== 'mod') { div = res.div.neg(); } if (mode !== 'div') { mod = res.mod.neg(); if (positive && mod.negative !== 0) { mod.iadd(num); } } return { div: div, mod: mod }; } if (this.negative === 0 && num.negative !== 0) { res = this.divmod(num.neg(), mode); if (mode !== 'mod') { div = res.div.neg(); } return { div: div, mod: res.mod }; } if ((this.negative & num.negative) !== 0) { res = this.neg().divmod(num.neg(), mode); if (mode !== 'div') { mod = res.mod.neg(); if (positive && mod.negative !== 0) { mod.isub(num); } } return { div: res.div, mod: mod }; } // Both numbers are positive at this point // Strip both numbers to approximate shift value if (num.length > this.length || this.cmp(num) < 0) { return { div: new BN(0), mod: this }; } // Very short reduction if (num.length === 1) { if (mode === 'div') { return { div: this.divn(num.words[0]), mod: null }; } if (mode === 'mod') { return { div: null, mod: new BN(this.modrn(num.words[0])) }; } return { div: this.divn(num.words[0]), mod: new BN(this.modrn(num.words[0])) }; } return this._wordDiv(num, mode); }; // Find `this` / `num` BN.prototype.div = function div (num) { return this.divmod(num, 'div', false).div; }; // Find `this` % `num` BN.prototype.mod = function mod (num) { return this.divmod(num, 'mod', false).mod; }; BN.prototype.umod = function umod (num) { return this.divmod(num, 'mod', true).mod; }; // Find Round(`this` / `num`) BN.prototype.divRound = function divRound (num) { var dm = this.divmod(num); // Fast case - exact division if (dm.mod.isZero()) return dm.div; var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod; var half = num.ushrn(1); var r2 = num.andln(1); var cmp = mod.cmp(half); // Round down if (cmp < 0 || (r2 === 1 && cmp === 0)) return dm.div; // Round up return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1); }; BN.prototype.modrn = function modrn (num) { var isNegNum = num < 0; if (isNegNum) num = -num; assert(num <= 0x3ffffff); var p = (1 << 26) % num; var acc = 0; for (var i = this.length - 1; i >= 0; i--) { acc = (p * acc + (this.words[i] | 0)) % num; } return isNegNum ? -acc : acc; }; // WARNING: DEPRECATED BN.prototype.modn = function modn (num) { return this.modrn(num); }; // In-place division by number BN.prototype.idivn = function idivn (num) { var isNegNum = num < 0; if (isNegNum) num = -num; assert(num <= 0x3ffffff); var carry = 0; for (var i = this.length - 1; i >= 0; i--) { var w = (this.words[i] | 0) + carry * 0x4000000; this.words[i] = (w / num) | 0; carry = w % num; } this._strip(); return isNegNum ? this.ineg() : this; }; BN.prototype.divn = function divn (num) { return this.clone().idivn(num); }; BN.prototype.egcd = function egcd (p) { assert(p.negative === 0); assert(!p.isZero()); var x = this; var y = p.clone(); if (x.negative !== 0) { x = x.umod(p); } else { x = x.clone(); } // A * x + B * y = x var A = new BN(1); var B = new BN(0); // C * x + D * y = y var C = new BN(0); var D = new BN(1); var g = 0; while (x.isEven() && y.isEven()) { x.iushrn(1); y.iushrn(1); ++g; } var yp = y.clone(); var xp = x.clone(); while (!x.isZero()) { for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1); if (i > 0) { x.iushrn(i); while (i-- > 0) { if (A.isOdd() || B.isOdd()) { A.iadd(yp); B.isub(xp); } A.iushrn(1); B.iushrn(1); } } for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); if (j > 0) { y.iushrn(j); while (j-- > 0) { if (C.isOdd() || D.isOdd()) { C.iadd(yp); D.isub(xp); } C.iushrn(1); D.iushrn(1); } } if (x.cmp(y) >= 0) { x.isub(y); A.isub(C); B.isub(D); } else { y.isub(x); C.isub(A); D.isub(B); } } return { a: C, b: D, gcd: y.iushln(g) }; }; // This is reduced incarnation of the binary EEA // above, designated to invert members of the // _prime_ fields F(p) at a maximal speed BN.prototype._invmp = function _invmp (p) { assert(p.negative === 0); assert(!p.isZero()); var a = this; var b = p.clone(); if (a.negative !== 0) { a = a.umod(p); } else { a = a.clone(); } var x1 = new BN(1); var x2 = new BN(0); var delta = b.clone(); while (a.cmpn(1) > 0 && b.cmpn(1) > 0) { for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1); if (i > 0) { a.iushrn(i); while (i-- > 0) { if (x1.isOdd()) { x1.iadd(delta); } x1.iushrn(1); } } for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); if (j > 0) { b.iushrn(j); while (j-- > 0) { if (x2.isOdd()) { x2.iadd(delta); } x2.iushrn(1); } } if (a.cmp(b) >= 0) { a.isub(b); x1.isub(x2); } else { b.isub(a); x2.isub(x1); } } var res; if (a.cmpn(1) === 0) { res = x1; } else { res = x2; } if (res.cmpn(0) < 0) { res.iadd(p); } return res; }; BN.prototype.gcd = function gcd (num) { if (this.isZero()) return num.abs(); if (num.isZero()) return this.abs(); var a = this.clone(); var b = num.clone(); a.negative = 0; b.negative = 0; // Remove common factor of two for (var shift = 0; a.isEven() && b.isEven(); shift++) { a.iushrn(1); b.iushrn(1); } do { while (a.isEven()) { a.iushrn(1); } while (b.isEven()) { b.iushrn(1); } var r = a.cmp(b); if (r < 0) { // Swap `a` and `b` to make `a` always bigger than `b` var t = a; a = b; b = t; } else if (r === 0 || b.cmpn(1) === 0) { break; } a.isub(b); } while (true); return b.iushln(shift); }; // Invert number in the field F(num) BN.prototype.invm = function invm (num) { return this.egcd(num).a.umod(num); }; BN.prototype.isEven = function isEven () { return (this.words[0] & 1) === 0; }; BN.prototype.isOdd = function isOdd () { return (this.words[0] & 1) === 1; }; // And first word and num BN.prototype.andln = function andln (num) { return this.words[0] & num; }; // Increment at the bit position in-line BN.prototype.bincn = function bincn (bit) { assert(typeof bit === 'number'); var r = bit % 26; var s = (bit - r) / 26; var q = 1 << r; // Fast case: bit is much higher than all existing words if (this.length <= s) { this._expand(s + 1); this.words[s] |= q; return this; } // Add bit and propagate, if needed var carry = q; for (var i = s; carry !== 0 && i < this.length; i++) { var w = this.words[i] | 0; w += carry; carry = w >>> 26; w &= 0x3ffffff; this.words[i] = w; } if (carry !== 0) { this.words[i] = carry; this.length++; } return this; }; BN.prototype.isZero = function isZero () { return this.length === 1 && this.words[0] === 0; }; BN.prototype.cmpn = function cmpn (num) { var negative = num < 0; if (this.negative !== 0 && !negative) return -1; if (this.negative === 0 && negative) return 1; this._strip(); var res; if (this.length > 1) { res = 1; } else { if (negative) { num = -num; } assert(num <= 0x3ffffff, 'Number is too big'); var w = this.words[0] | 0; res = w === num ? 0 : w < num ? -1 : 1; } if (this.negative !== 0) return -res | 0; return res; }; // Compare two numbers and return: // 1 - if `this` > `num` // 0 - if `this` == `num` // -1 - if `this` < `num` BN.prototype.cmp = function cmp (num) { if (this.negative !== 0 && num.negative === 0) return -1; if (this.negative === 0 && num.negative !== 0) return 1; var res = this.ucmp(num); if (this.negative !== 0) return -res | 0; return res; }; // Unsigned comparison BN.prototype.ucmp = function ucmp (num) { // At this point both numbers have the same sign if (this.length > num.length) return 1; if (this.length < num.length) return -1; var res = 0; for (var i = this.length - 1; i >= 0; i--) { var a = this.words[i] | 0; var b = num.words[i] | 0; if (a === b) continue; if (a < b) { res = -1; } else if (a > b) { res = 1; } break; } return res; }; BN.prototype.gtn = function gtn (num) { return this.cmpn(num) === 1; }; BN.prototype.gt = function gt (num) { return this.cmp(num) === 1; }; BN.prototype.gten = function gten (num) { return this.cmpn(num) >= 0; }; BN.prototype.gte = function gte (num) { return this.cmp(num) >= 0; }; BN.prototype.ltn = function ltn (num) { return this.cmpn(num) === -1; }; BN.prototype.lt = function lt (num) { return this.cmp(num) === -1; }; BN.prototype.lten = function lten (num) { return this.cmpn(num) <= 0; }; BN.prototype.lte = function lte (num) { return this.cmp(num) <= 0; }; BN.prototype.eqn = function eqn (num) { return this.cmpn(num) === 0; }; BN.prototype.eq = function eq (num) { return this.cmp(num) === 0; }; // // A reduce context, could be using montgomery or something better, depending // on the `m` itself. // BN.red = function red (num) { return new Red(num); }; BN.prototype.toRed = function toRed (ctx) { assert(!this.red, 'Already a number in reduction context'); assert(this.negative === 0, 'red works only with positives'); return ctx.convertTo(this)._forceRed(ctx); }; BN.prototype.fromRed = function fromRed () { assert(this.red, 'fromRed works only with numbers in reduction context'); return this.red.convertFrom(this); }; BN.prototype._forceRed = function _forceRed (ctx) { this.red = ctx; return this; }; BN.prototype.forceRed = function forceRed (ctx) { assert(!this.red, 'Already a number in reduction context'); return this._forceRed(ctx); }; BN.prototype.redAdd = function redAdd (num) { assert(this.red, 'redAdd works only with red numbers'); return this.red.add(this, num); }; BN.prototype.redIAdd = function redIAdd (num) { assert(this.red, 'redIAdd works only with red numbers'); return this.red.iadd(this, num); }; BN.prototype.redSub = function redSub (num) { assert(this.red, 'redSub works only with red numbers'); return this.red.sub(this, num); }; BN.prototype.redISub = function redISub (num) { assert(this.red, 'redISub works only with red numbers'); return this.red.isub(this, num); }; BN.prototype.redShl = function redShl (num) { assert(this.red, 'redShl works only with red numbers'); return this.red.shl(this, num); }; BN.prototype.redMul = function redMul (num) { assert(this.red, 'redMul works only with red numbers'); this.red._verify2(this, num); return this.red.mul(this, num); }; BN.prototype.redIMul = function redIMul (num) { assert(this.red, 'redMul works only with red numbers'); this.red._verify2(this, num); return this.red.imul(this, num); }; BN.prototype.redSqr = function redSqr () { assert(this.red, 'redSqr works only with red numbers'); this.red._verify1(this); return this.red.sqr(this); }; BN.prototype.redISqr = function redISqr () { assert(this.red, 'redISqr works only with red numbers'); this.red._verify1(this); return this.red.isqr(this); }; // Square root over p BN.prototype.redSqrt = function redSqrt () { assert(this.red, 'redSqrt works only with red numbers'); this.red._verify1(this); return this.red.sqrt(this); }; BN.prototype.redInvm = function redInvm () { assert(this.red, 'redInvm works only with red numbers'); this.red._verify1(this); return this.red.invm(this); }; // Return negative clone of `this` % `red modulo` BN.prototype.redNeg = function redNeg () { assert(this.red, 'redNeg works only with red numbers'); this.red._verify1(this); return this.red.neg(this); }; BN.prototype.redPow = function redPow (num) { assert(this.red && !num.red, 'redPow(normalNum)'); this.red._verify1(this); return this.red.pow(this, num); }; // Prime numbers with efficient reduction var primes = { k256: null, p224: null, p192: null, p25519: null }; // Pseudo-Mersenne prime function MPrime (name, p) { // P = 2 ^ N - K this.name = name; this.p = new BN(p, 16); this.n = this.p.bitLength(); this.k = new BN(1).iushln(this.n).isub(this.p); this.tmp = this._tmp(); } MPrime.prototype._tmp = function _tmp () { var tmp = new BN(null); tmp.words = new Array(Math.ceil(this.n / 13)); return tmp; }; MPrime.prototype.ireduce = function ireduce (num) { // Assumes that `num` is less than `P^2` // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P) var r = num; var rlen; do { this.split(r, this.tmp); r = this.imulK(r); r = r.iadd(this.tmp); rlen = r.bitLength(); } while (rlen > this.n); var cmp = rlen < this.n ? -1 : r.ucmp(this.p); if (cmp === 0) { r.words[0] = 0; r.length = 1; } else if (cmp > 0) { r.isub(this.p); } else { if (r.strip !== undefined) { // r is a BN v4 instance r.strip(); } else { // r is a BN v5 instance r._strip(); } } return r; }; MPrime.prototype.split = function split (input, out) { input.iushrn(this.n, 0, out); }; MPrime.prototype.imulK = function imulK (num) { return num.imul(this.k); }; function K256 () { MPrime.call( this, 'k256', 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f'); } inherits(K256, MPrime); K256.prototype.split = function split (input, output) { // 256 = 9 * 26 + 22 var mask = 0x3fffff; var outLen = Math.min(input.length, 9); for (var i = 0; i < outLen; i++) { output.words[i] = input.words[i]; } output.length = outLen; if (input.length <= 9) { input.words[0] = 0; input.length = 1; return; } // Shift by 9 limbs var prev = input.words[9]; output.words[output.length++] = prev & mask; for (i = 10; i < input.length; i++) { var next = input.words[i] | 0; input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22); prev = next; } prev >>>= 22; input.words[i - 10] = prev; if (prev === 0 && input.length > 10) { input.length -= 10; } else { input.length -= 9; } }; K256.prototype.imulK = function imulK (num) { // K = 0x1000003d1 = [ 0x40, 0x3d1 ] num.words[num.length] = 0; num.words[num.length + 1] = 0; num.length += 2; // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390 var lo = 0; for (var i = 0; i < num.length; i++) { var w = num.words[i] | 0; lo += w * 0x3d1; num.words[i] = lo & 0x3ffffff; lo = w * 0x40 + ((lo / 0x4000000) | 0); } // Fast length reduction if (num.words[num.length - 1] === 0) { num.length--; if (num.words[num.length - 1] === 0) { num.length--; } } return num; }; function P224 () { MPrime.call( this, 'p224', 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001'); } inherits(P224, MPrime); function P192 () { MPrime.call( this, 'p192', 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff'); } inherits(P192, MPrime); function P25519 () { // 2 ^ 255 - 19 MPrime.call( this, '25519', '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed'); } inherits(P25519, MPrime); P25519.prototype.imulK = function imulK (num) { // K = 0x13 var carry = 0; for (var i = 0; i < num.length; i++) { var hi = (num.words[i] | 0) * 0x13 + carry; var lo = hi & 0x3ffffff; hi >>>= 26; num.words[i] = lo; carry = hi; } if (carry !== 0) { num.words[num.length++] = carry; } return num; }; // Exported mostly for testing purposes, use plain name instead BN._prime = function prime (name) { // Cached version of prime if (primes[name]) return primes[name]; var prime; if (name === 'k256') { prime = new K256(); } else if (name === 'p224') { prime = new P224(); } else if (name === 'p192') { prime = new P192(); } else if (name === 'p25519') { prime = new P25519(); } else { throw new Error('Unknown prime ' + name); } primes[name] = prime; return prime; }; // // Base reduction engine // function Red (m) { if (typeof m === 'string') { var prime = BN._prime(m); this.m = prime.p; this.prime = prime; } else { assert(m.gtn(1), 'modulus must be greater than 1'); this.m = m; this.prime = null; } } Red.prototype._verify1 = function _verify1 (a) { assert(a.negative === 0, 'red works only with positives'); assert(a.red, 'red works only with red numbers'); }; Red.prototype._verify2 = function _verify2 (a, b) { assert((a.negative | b.negative) === 0, 'red works only with positives'); assert(a.red && a.red === b.red, 'red works only with red numbers'); }; Red.prototype.imod = function imod (a) { if (this.prime) return this.prime.ireduce(a)._forceRed(this); move(a, a.umod(this.m)._forceRed(this)); return a; }; Red.prototype.neg = function neg (a) { if (a.isZero()) { return a.clone(); } return this.m.sub(a)._forceRed(this); }; Red.prototype.add = function add (a, b) { this._verify2(a, b); var res = a.add(b); if (res.cmp(this.m) >= 0) { res.isub(this.m); } return res._forceRed(this); }; Red.prototype.iadd = function iadd (a, b) { this._verify2(a, b); var res = a.iadd(b); if (res.cmp(this.m) >= 0) { res.isub(this.m); } return res; }; Red.prototype.sub = function sub (a, b) { this._verify2(a, b); var res = a.sub(b); if (res.cmpn(0) < 0) { res.iadd(this.m); } return res._forceRed(this); }; Red.prototype.isub = function isub (a, b) { this._verify2(a, b); var res = a.isub(b); if (res.cmpn(0) < 0) { res.iadd(this.m); } return res; }; Red.prototype.shl = function shl (a, num) { this._verify1(a); return this.imod(a.ushln(num)); }; Red.prototype.imul = function imul (a, b) { this._verify2(a, b); return this.imod(a.imul(b)); }; Red.prototype.mul = function mul (a, b) { this._verify2(a, b); return this.imod(a.mul(b)); }; Red.prototype.isqr = function isqr (a) { return this.imul(a, a.clone()); }; Red.prototype.sqr = function sqr (a) { return this.mul(a, a); }; Red.prototype.sqrt = function sqrt (a) { if (a.isZero()) return a.clone(); var mod3 = this.m.andln(3); assert(mod3 % 2 === 1); // Fast case if (mod3 === 3) { var pow = this.m.add(new BN(1)).iushrn(2); return this.pow(a, pow); } // Tonelli-Shanks algorithm (Totally unoptimized and slow) // // Find Q and S, that Q * 2 ^ S = (P - 1) var q = this.m.subn(1); var s = 0; while (!q.isZero() && q.andln(1) === 0) { s++; q.iushrn(1); } assert(!q.isZero()); var one = new BN(1).toRed(this); var nOne = one.redNeg(); // Find quadratic non-residue // NOTE: Max is such because of generalized Riemann hypothesis. var lpow = this.m.subn(1).iushrn(1); var z = this.m.bitLength(); z = new BN(2 * z * z).toRed(this); while (this.pow(z, lpow).cmp(nOne) !== 0) { z.redIAdd(nOne); } var c = this.pow(z, q); var r = this.pow(a, q.addn(1).iushrn(1)); var t = this.pow(a, q); var m = s; while (t.cmp(one) !== 0) { var tmp = t; for (var i = 0; tmp.cmp(one) !== 0; i++) { tmp = tmp.redSqr(); } assert(i < m); var b = this.pow(c, new BN(1).iushln(m - i - 1)); r = r.redMul(b); c = b.redSqr(); t = t.redMul(c); m = i; } return r; }; Red.prototype.invm = function invm (a) { var inv = a._invmp(this.m); if (inv.negative !== 0) { inv.negative = 0; return this.imod(inv).redNeg(); } else { return this.imod(inv); } }; Red.prototype.pow = function pow (a, num) { if (num.isZero()) return new BN(1).toRed(this); if (num.cmpn(1) === 0) return a.clone(); var windowSize = 4; var wnd = new Array(1 << windowSize); wnd[0] = new BN(1).toRed(this); wnd[1] = a; for (var i = 2; i < wnd.length; i++) { wnd[i] = this.mul(wnd[i - 1], a); } var res = wnd[0]; var current = 0; var currentLen = 0; var start = num.bitLength() % 26; if (start === 0) { start = 26; } for (i = num.length - 1; i >= 0; i--) { var word = num.words[i]; for (var j = start - 1; j >= 0; j--) { var bit = (word >> j) & 1; if (res !== wnd[0]) { res = this.sqr(res); } if (bit === 0 && current === 0) { currentLen = 0; continue; } current <<= 1; current |= bit; currentLen++; if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue; res = this.mul(res, wnd[current]); currentLen = 0; current = 0; } start = 26; } return res; }; Red.prototype.convertTo = function convertTo (num) { var r = num.umod(this.m); return r === num ? r.clone() : r; }; Red.prototype.convertFrom = function convertFrom (num) { var res = num.clone(); res.red = null; return res; }; // // Montgomery method engine // BN.mont = function mont (num) { return new Mont(num); }; function Mont (m) { Red.call(this, m); this.shift = this.m.bitLength(); if (this.shift % 26 !== 0) { this.shift += 26 - (this.shift % 26); } this.r = new BN(1).iushln(this.shift); this.r2 = this.imod(this.r.sqr()); this.rinv = this.r._invmp(this.m); this.minv = this.rinv.mul(this.r).isubn(1).div(this.m); this.minv = this.minv.umod(this.r); this.minv = this.r.sub(this.minv); } inherits(Mont, Red); Mont.prototype.convertTo = function convertTo (num) { return this.imod(num.ushln(this.shift)); }; Mont.prototype.convertFrom = function convertFrom (num) { var r = this.imod(num.mul(this.rinv)); r.red = null; return r; }; Mont.prototype.imul = function imul (a, b) { if (a.isZero() || b.isZero()) { a.words[0] = 0; a.length = 1; return a; } var t = a.imul(b); var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); var u = t.isub(c).iushrn(this.shift); var res = u; if (u.cmp(this.m) >= 0) { res = u.isub(this.m); } else if (u.cmpn(0) < 0) { res = u.iadd(this.m); } return res._forceRed(this); }; Mont.prototype.mul = function mul (a, b) { if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this); var t = a.mul(b); var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); var u = t.isub(c).iushrn(this.shift); var res = u; if (u.cmp(this.m) >= 0) { res = u.isub(this.m); } else if (u.cmpn(0) < 0) { res = u.iadd(this.m); } return res._forceRed(this); }; Mont.prototype.invm = function invm (a) { // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R var res = this.imod(a._invmp(this.m).mul(this.r2)); return res._forceRed(this); }; })( false || module, this); /***/ }), /***/ 31886: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { "keccak256": function() { return /* binding */ keccak256; }, "pack": function() { return /* binding */ pack; }, "sha256": function() { return /* binding */ sha256; } }); // EXTERNAL MODULE: ./node_modules/@ethersproject/bignumber/lib.esm/bignumber.js var bignumber = __webpack_require__(2593); // EXTERNAL MODULE: ./node_modules/@ethersproject/bytes/lib.esm/index.js + 1 modules var lib_esm = __webpack_require__(16441); // EXTERNAL MODULE: ./node_modules/@ethersproject/keccak256/lib.esm/index.js var keccak256_lib_esm = __webpack_require__(38197); // EXTERNAL MODULE: ./node_modules/@ethersproject/sha2/lib.esm/sha2.js + 1 modules var sha2 = __webpack_require__(2006); // EXTERNAL MODULE: ./node_modules/@ethersproject/strings/lib.esm/utf8.js + 1 modules var utf8 = __webpack_require__(29251); // EXTERNAL MODULE: ./node_modules/@ethersproject/logger/lib.esm/index.js + 1 modules var logger_lib_esm = __webpack_require__(1581); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/solidity/lib.esm/_version.js const version = "solidity/5.6.1"; //# sourceMappingURL=_version.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/solidity/lib.esm/index.js const regexBytes = new RegExp("^bytes([0-9]+)$"); const regexNumber = new RegExp("^(u?int)([0-9]*)$"); const regexArray = new RegExp("^(.*)\\[([0-9]*)\\]$"); const Zeros = "0000000000000000000000000000000000000000000000000000000000000000"; const logger = new logger_lib_esm.Logger(version); function _pack(type, value, isArray) { switch (type) { case "address": if (isArray) { return (0,lib_esm.zeroPad)(value, 32); } return (0,lib_esm.arrayify)(value); case "string": return (0,utf8/* toUtf8Bytes */.Y0)(value); case "bytes": return (0,lib_esm.arrayify)(value); case "bool": value = (value ? "0x01" : "0x00"); if (isArray) { return (0,lib_esm.zeroPad)(value, 32); } return (0,lib_esm.arrayify)(value); } let match = type.match(regexNumber); if (match) { //let signed = (match[1] === "int") let size = parseInt(match[2] || "256"); if ((match[2] && String(size) !== match[2]) || (size % 8 !== 0) || size === 0 || size > 256) { logger.throwArgumentError("invalid number type", "type", type); } if (isArray) { size = 256; } value = bignumber/* BigNumber.from */.O$.from(value).toTwos(size); return (0,lib_esm.zeroPad)(value, size / 8); } match = type.match(regexBytes); if (match) { const size = parseInt(match[1]); if (String(size) !== match[1] || size === 0 || size > 32) { logger.throwArgumentError("invalid bytes type", "type", type); } if ((0,lib_esm.arrayify)(value).byteLength !== size) { logger.throwArgumentError(`invalid value for ${type}`, "value", value); } if (isArray) { return (0,lib_esm.arrayify)((value + Zeros).substring(0, 66)); } return value; } match = type.match(regexArray); if (match && Array.isArray(value)) { const baseType = match[1]; const count = parseInt(match[2] || String(value.length)); if (count != value.length) { logger.throwArgumentError(`invalid array length for ${type}`, "value", value); } const result = []; value.forEach(function (value) { result.push(_pack(baseType, value, true)); }); return (0,lib_esm.concat)(result); } return logger.throwArgumentError("invalid type", "type", type); } // @TODO: Array Enum function pack(types, values) { if (types.length != values.length) { logger.throwArgumentError("wrong number of values; expected ${ types.length }", "values", values); } const tight = []; types.forEach(function (type, index) { tight.push(_pack(type, values[index])); }); return (0,lib_esm.hexlify)((0,lib_esm.concat)(tight)); } function keccak256(types, values) { return (0,keccak256_lib_esm.keccak256)(pack(types, values)); } function sha256(types, values) { return (0,sha2/* sha256 */.JQ)(pack(types, values)); } //# sourceMappingURL=index.js.map /***/ }), /***/ 86237: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "F": function() { return /* binding */ parseBytes32String; }, /* harmony export */ "s": function() { return /* binding */ formatBytes32String; } /* harmony export */ }); /* harmony import */ var _ethersproject_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(57218); /* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16441); /* harmony import */ var _utf8__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(29251); function formatBytes32String(text) { // Get the bytes const bytes = (0,_utf8__WEBPACK_IMPORTED_MODULE_0__/* .toUtf8Bytes */ .Y0)(text); // Check we have room for null-termination if (bytes.length > 31) { throw new Error("bytes32 string must be less than 32 bytes"); } // Zero-pad (implicitly null-terminates) return (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__.hexlify)((0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__.concat)([bytes, _ethersproject_constants__WEBPACK_IMPORTED_MODULE_2__/* .HashZero */ .R]).slice(0, 32)); } function parseBytes32String(bytes) { const data = (0,_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__.arrayify)(bytes); // Must be 32 bytes with a null-termination if (data.length !== 32) { throw new Error("invalid bytes32 - not 32 bytes long"); } if (data[31] !== 0) { throw new Error("invalid bytes32 string - no null terminator"); } // Find the null termination let length = 31; while (data[length - 1] === 0) { length--; } // Determine the string value return (0,_utf8__WEBPACK_IMPORTED_MODULE_0__/* .toUtf8String */ .ZN)(data.slice(0, length)); } //# sourceMappingURL=bytes32.js.map /***/ }), /***/ 35637: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Ll": function() { return /* binding */ nameprep; } /* harmony export */ }); /* unused harmony exports _nameprepTableA1, _nameprepTableB2, _nameprepTableC */ /* harmony import */ var _utf8__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(29251); function bytes2(data) { if ((data.length % 4) !== 0) { throw new Error("bad data"); } let result = []; for (let i = 0; i < data.length; i += 4) { result.push(parseInt(data.substring(i, i + 4), 16)); } return result; } function createTable(data, func) { if (!func) { func = function (value) { return [parseInt(value, 16)]; }; } let lo = 0; let result = {}; data.split(",").forEach((pair) => { let comps = pair.split(":"); lo += parseInt(comps[0], 16); result[lo] = func(comps[1]); }); return result; } function createRangeTable(data) { let hi = 0; return data.split(",").map((v) => { let comps = v.split("-"); if (comps.length === 1) { comps[1] = "0"; } else if (comps[1] === "") { comps[1] = "1"; } let lo = hi + parseInt(comps[0], 16); hi = parseInt(comps[1], 16); return { l: lo, h: hi }; }); } function matchMap(value, ranges) { let lo = 0; for (let i = 0; i < ranges.length; i++) { let range = ranges[i]; lo += range.l; if (value >= lo && value <= lo + range.h && ((value - lo) % (range.d || 1)) === 0) { if (range.e && range.e.indexOf(value - lo) !== -1) { continue; } return range; } } return null; } const Table_A_1_ranges = createRangeTable("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"); // @TODO: Make this relative... const Table_B_1_flags = "ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((v) => parseInt(v, 16)); const Table_B_2_ranges = [ { h: 25, s: 32, l: 65 }, { h: 30, s: 32, e: [23], l: 127 }, { h: 54, s: 1, e: [48], l: 64, d: 2 }, { h: 14, s: 1, l: 57, d: 2 }, { h: 44, s: 1, l: 17, d: 2 }, { h: 10, s: 1, e: [2, 6, 8], l: 61, d: 2 }, { h: 16, s: 1, l: 68, d: 2 }, { h: 84, s: 1, e: [18, 24, 66], l: 19, d: 2 }, { h: 26, s: 32, e: [17], l: 435 }, { h: 22, s: 1, l: 71, d: 2 }, { h: 15, s: 80, l: 40 }, { h: 31, s: 32, l: 16 }, { h: 32, s: 1, l: 80, d: 2 }, { h: 52, s: 1, l: 42, d: 2 }, { h: 12, s: 1, l: 55, d: 2 }, { h: 40, s: 1, e: [38], l: 15, d: 2 }, { h: 14, s: 1, l: 48, d: 2 }, { h: 37, s: 48, l: 49 }, { h: 148, s: 1, l: 6351, d: 2 }, { h: 88, s: 1, l: 160, d: 2 }, { h: 15, s: 16, l: 704 }, { h: 25, s: 26, l: 854 }, { h: 25, s: 32, l: 55915 }, { h: 37, s: 40, l: 1247 }, { h: 25, s: -119711, l: 53248 }, { h: 25, s: -119763, l: 52 }, { h: 25, s: -119815, l: 52 }, { h: 25, s: -119867, e: [1, 4, 5, 7, 8, 11, 12, 17], l: 52 }, { h: 25, s: -119919, l: 52 }, { h: 24, s: -119971, e: [2, 7, 8, 17], l: 52 }, { h: 24, s: -120023, e: [2, 7, 13, 15, 16, 17], l: 52 }, { h: 25, s: -120075, l: 52 }, { h: 25, s: -120127, l: 52 }, { h: 25, s: -120179, l: 52 }, { h: 25, s: -120231, l: 52 }, { h: 25, s: -120283, l: 52 }, { h: 25, s: -120335, l: 52 }, { h: 24, s: -119543, e: [17], l: 56 }, { h: 24, s: -119601, e: [17], l: 58 }, { h: 24, s: -119659, e: [17], l: 58 }, { h: 24, s: -119717, e: [17], l: 58 }, { h: 24, s: -119775, e: [17], l: 58 } ]; const Table_B_2_lut_abs = createTable("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"); const Table_B_2_lut_rel = createTable("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"); const Table_B_2_complex = createTable("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D", bytes2); const Table_C_ranges = createRangeTable("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001"); function flatten(values) { return values.reduce((accum, value) => { value.forEach((value) => { accum.push(value); }); return accum; }, []); } function _nameprepTableA1(codepoint) { return !!matchMap(codepoint, Table_A_1_ranges); } function _nameprepTableB2(codepoint) { let range = matchMap(codepoint, Table_B_2_ranges); if (range) { return [codepoint + range.s]; } let codes = Table_B_2_lut_abs[codepoint]; if (codes) { return codes; } let shift = Table_B_2_lut_rel[codepoint]; if (shift) { return [codepoint + shift[0]]; } let complex = Table_B_2_complex[codepoint]; if (complex) { return complex; } return null; } function _nameprepTableC(codepoint) { return !!matchMap(codepoint, Table_C_ranges); } function nameprep(value) { // This allows platforms with incomplete normalize to bypass // it for very basic names which the built-in toLowerCase // will certainly handle correctly if (value.match(/^[a-z0-9-]*$/i) && value.length <= 59) { return value.toLowerCase(); } // Get the code points (keeping the current normalization) let codes = (0,_utf8__WEBPACK_IMPORTED_MODULE_0__/* .toUtf8CodePoints */ .XL)(value); codes = flatten(codes.map((code) => { // Substitute Table B.1 (Maps to Nothing) if (Table_B_1_flags.indexOf(code) >= 0) { return []; } if (code >= 0xfe00 && code <= 0xfe0f) { return []; } // Substitute Table B.2 (Case Folding) let codesTableB2 = _nameprepTableB2(code); if (codesTableB2) { return codesTableB2; } // No Substitution return [code]; })); // Normalize using form KC codes = (0,_utf8__WEBPACK_IMPORTED_MODULE_0__/* .toUtf8CodePoints */ .XL)((0,_utf8__WEBPACK_IMPORTED_MODULE_0__/* ._toUtf8String */ .uu)(codes), _utf8__WEBPACK_IMPORTED_MODULE_0__/* .UnicodeNormalizationForm.NFKC */ .Uj.NFKC); // Prohibit Tables C.1.2, C.2.2, C.3, C.4, C.5, C.6, C.7, C.8, C.9 codes.forEach((code) => { if (_nameprepTableC(code)) { throw new Error("STRINGPREP_CONTAINS_PROHIBITED"); } }); // Prohibit Unassigned Code Points (Table A.1) codes.forEach((code) => { if (_nameprepTableA1(code)) { throw new Error("STRINGPREP_CONTAINS_UNASSIGNED"); } }); // IDNA extras let name = (0,_utf8__WEBPACK_IMPORTED_MODULE_0__/* ._toUtf8String */ .uu)(codes); // IDNA: 4.2.3.1 if (name.substring(0, 1) === "-" || name.substring(2, 4) === "--" || name.substring(name.length - 1) === "-") { throw new Error("invalid hyphen"); } // IDNA: 4.2.4 if (name.length > 63) { throw new Error("too long"); } return name; } //# sourceMappingURL=idna.js.map /***/ }), /***/ 62741: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "UnicodeNormalizationForm": function() { return /* reexport safe */ _utf8__WEBPACK_IMPORTED_MODULE_0__.Uj; }, /* harmony export */ "Utf8ErrorFuncs": function() { return /* reexport safe */ _utf8__WEBPACK_IMPORTED_MODULE_0__.te; }, /* harmony export */ "Utf8ErrorReason": function() { return /* reexport safe */ _utf8__WEBPACK_IMPORTED_MODULE_0__.Uw; }, /* harmony export */ "_toEscapedUtf8String": function() { return /* reexport safe */ _utf8__WEBPACK_IMPORTED_MODULE_0__.U$; }, /* harmony export */ "formatBytes32String": function() { return /* reexport safe */ _bytes32__WEBPACK_IMPORTED_MODULE_1__.s; }, /* harmony export */ "nameprep": function() { return /* reexport safe */ _idna__WEBPACK_IMPORTED_MODULE_2__.Ll; }, /* harmony export */ "parseBytes32String": function() { return /* reexport safe */ _bytes32__WEBPACK_IMPORTED_MODULE_1__.F; }, /* harmony export */ "toUtf8Bytes": function() { return /* reexport safe */ _utf8__WEBPACK_IMPORTED_MODULE_0__.Y0; }, /* harmony export */ "toUtf8CodePoints": function() { return /* reexport safe */ _utf8__WEBPACK_IMPORTED_MODULE_0__.XL; }, /* harmony export */ "toUtf8String": function() { return /* reexport safe */ _utf8__WEBPACK_IMPORTED_MODULE_0__.ZN; } /* harmony export */ }); /* harmony import */ var _bytes32__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(86237); /* harmony import */ var _idna__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(35637); /* harmony import */ var _utf8__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(29251); //# sourceMappingURL=index.js.map /***/ }), /***/ 29251: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { "Uj": function() { return /* binding */ UnicodeNormalizationForm; }, "te": function() { return /* binding */ Utf8ErrorFuncs; }, "Uw": function() { return /* binding */ Utf8ErrorReason; }, "U$": function() { return /* binding */ _toEscapedUtf8String; }, "uu": function() { return /* binding */ _toUtf8String; }, "Y0": function() { return /* binding */ toUtf8Bytes; }, "XL": function() { return /* binding */ toUtf8CodePoints; }, "ZN": function() { return /* binding */ toUtf8String; } }); // EXTERNAL MODULE: ./node_modules/@ethersproject/bytes/lib.esm/index.js + 1 modules var lib_esm = __webpack_require__(16441); // EXTERNAL MODULE: ./node_modules/@ethersproject/logger/lib.esm/index.js + 1 modules var logger_lib_esm = __webpack_require__(1581); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/strings/lib.esm/_version.js const version = "strings/5.6.1"; //# sourceMappingURL=_version.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/strings/lib.esm/utf8.js const logger = new logger_lib_esm.Logger(version); /////////////////////////////// var UnicodeNormalizationForm; (function (UnicodeNormalizationForm) { UnicodeNormalizationForm["current"] = ""; UnicodeNormalizationForm["NFC"] = "NFC"; UnicodeNormalizationForm["NFD"] = "NFD"; UnicodeNormalizationForm["NFKC"] = "NFKC"; UnicodeNormalizationForm["NFKD"] = "NFKD"; })(UnicodeNormalizationForm || (UnicodeNormalizationForm = {})); ; var Utf8ErrorReason; (function (Utf8ErrorReason) { // A continuation byte was present where there was nothing to continue // - offset = the index the codepoint began in Utf8ErrorReason["UNEXPECTED_CONTINUE"] = "unexpected continuation byte"; // An invalid (non-continuation) byte to start a UTF-8 codepoint was found // - offset = the index the codepoint began in Utf8ErrorReason["BAD_PREFIX"] = "bad codepoint prefix"; // The string is too short to process the expected codepoint // - offset = the index the codepoint began in Utf8ErrorReason["OVERRUN"] = "string overrun"; // A missing continuation byte was expected but not found // - offset = the index the continuation byte was expected at Utf8ErrorReason["MISSING_CONTINUE"] = "missing continuation byte"; // The computed code point is outside the range for UTF-8 // - offset = start of this codepoint // - badCodepoint = the computed codepoint; outside the UTF-8 range Utf8ErrorReason["OUT_OF_RANGE"] = "out of UTF-8 range"; // UTF-8 strings may not contain UTF-16 surrogate pairs // - offset = start of this codepoint // - badCodepoint = the computed codepoint; inside the UTF-16 surrogate range Utf8ErrorReason["UTF16_SURROGATE"] = "UTF-16 surrogate"; // The string is an overlong representation // - offset = start of this codepoint // - badCodepoint = the computed codepoint; already bounds checked Utf8ErrorReason["OVERLONG"] = "overlong representation"; })(Utf8ErrorReason || (Utf8ErrorReason = {})); ; function errorFunc(reason, offset, bytes, output, badCodepoint) { return logger.throwArgumentError(`invalid codepoint at offset ${offset}; ${reason}`, "bytes", bytes); } function ignoreFunc(reason, offset, bytes, output, badCodepoint) { // If there is an invalid prefix (including stray continuation), skip any additional continuation bytes if (reason === Utf8ErrorReason.BAD_PREFIX || reason === Utf8ErrorReason.UNEXPECTED_CONTINUE) { let i = 0; for (let o = offset + 1; o < bytes.length; o++) { if (bytes[o] >> 6 !== 0x02) { break; } i++; } return i; } // This byte runs us past the end of the string, so just jump to the end // (but the first byte was read already read and therefore skipped) if (reason === Utf8ErrorReason.OVERRUN) { return bytes.length - offset - 1; } // Nothing to skip return 0; } function replaceFunc(reason, offset, bytes, output, badCodepoint) { // Overlong representations are otherwise "valid" code points; just non-deistingtished if (reason === Utf8ErrorReason.OVERLONG) { output.push(badCodepoint); return 0; } // Put the replacement character into the output output.push(0xfffd); // Otherwise, process as if ignoring errors return ignoreFunc(reason, offset, bytes, output, badCodepoint); } // Common error handing strategies const Utf8ErrorFuncs = Object.freeze({ error: errorFunc, ignore: ignoreFunc, replace: replaceFunc }); // http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499 function getUtf8CodePoints(bytes, onError) { if (onError == null) { onError = Utf8ErrorFuncs.error; } bytes = (0,lib_esm.arrayify)(bytes); const result = []; let i = 0; // Invalid bytes are ignored while (i < bytes.length) { const c = bytes[i++]; // 0xxx xxxx if (c >> 7 === 0) { result.push(c); continue; } // Multibyte; how many bytes left for this character? let extraLength = null; let overlongMask = null; // 110x xxxx 10xx xxxx if ((c & 0xe0) === 0xc0) { extraLength = 1; overlongMask = 0x7f; // 1110 xxxx 10xx xxxx 10xx xxxx } else if ((c & 0xf0) === 0xe0) { extraLength = 2; overlongMask = 0x7ff; // 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx } else if ((c & 0xf8) === 0xf0) { extraLength = 3; overlongMask = 0xffff; } else { if ((c & 0xc0) === 0x80) { i += onError(Utf8ErrorReason.UNEXPECTED_CONTINUE, i - 1, bytes, result); } else { i += onError(Utf8ErrorReason.BAD_PREFIX, i - 1, bytes, result); } continue; } // Do we have enough bytes in our data? if (i - 1 + extraLength >= bytes.length) { i += onError(Utf8ErrorReason.OVERRUN, i - 1, bytes, result); continue; } // Remove the length prefix from the char let res = c & ((1 << (8 - extraLength - 1)) - 1); for (let j = 0; j < extraLength; j++) { let nextChar = bytes[i]; // Invalid continuation byte if ((nextChar & 0xc0) != 0x80) { i += onError(Utf8ErrorReason.MISSING_CONTINUE, i, bytes, result); res = null; break; } ; res = (res << 6) | (nextChar & 0x3f); i++; } // See above loop for invalid continuation byte if (res === null) { continue; } // Maximum code point if (res > 0x10ffff) { i += onError(Utf8ErrorReason.OUT_OF_RANGE, i - 1 - extraLength, bytes, result, res); continue; } // Reserved for UTF-16 surrogate halves if (res >= 0xd800 && res <= 0xdfff) { i += onError(Utf8ErrorReason.UTF16_SURROGATE, i - 1 - extraLength, bytes, result, res); continue; } // Check for overlong sequences (more bytes than needed) if (res <= overlongMask) { i += onError(Utf8ErrorReason.OVERLONG, i - 1 - extraLength, bytes, result, res); continue; } result.push(res); } return result; } // http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array function toUtf8Bytes(str, form = UnicodeNormalizationForm.current) { if (form != UnicodeNormalizationForm.current) { logger.checkNormalize(); str = str.normalize(form); } let result = []; for (let i = 0; i < str.length; i++) { const c = str.charCodeAt(i); if (c < 0x80) { result.push(c); } else if (c < 0x800) { result.push((c >> 6) | 0xc0); result.push((c & 0x3f) | 0x80); } else if ((c & 0xfc00) == 0xd800) { i++; const c2 = str.charCodeAt(i); if (i >= str.length || (c2 & 0xfc00) !== 0xdc00) { throw new Error("invalid utf-8 string"); } // Surrogate Pair const pair = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff); result.push((pair >> 18) | 0xf0); result.push(((pair >> 12) & 0x3f) | 0x80); result.push(((pair >> 6) & 0x3f) | 0x80); result.push((pair & 0x3f) | 0x80); } else { result.push((c >> 12) | 0xe0); result.push(((c >> 6) & 0x3f) | 0x80); result.push((c & 0x3f) | 0x80); } } return (0,lib_esm.arrayify)(result); } ; function escapeChar(value) { const hex = ("0000" + value.toString(16)); return "\\u" + hex.substring(hex.length - 4); } function _toEscapedUtf8String(bytes, onError) { return '"' + getUtf8CodePoints(bytes, onError).map((codePoint) => { if (codePoint < 256) { switch (codePoint) { case 8: return "\\b"; case 9: return "\\t"; case 10: return "\\n"; case 13: return "\\r"; case 34: return "\\\""; case 92: return "\\\\"; } if (codePoint >= 32 && codePoint < 127) { return String.fromCharCode(codePoint); } } if (codePoint <= 0xffff) { return escapeChar(codePoint); } codePoint -= 0x10000; return escapeChar(((codePoint >> 10) & 0x3ff) + 0xd800) + escapeChar((codePoint & 0x3ff) + 0xdc00); }).join("") + '"'; } function _toUtf8String(codePoints) { return codePoints.map((codePoint) => { if (codePoint <= 0xffff) { return String.fromCharCode(codePoint); } codePoint -= 0x10000; return String.fromCharCode((((codePoint >> 10) & 0x3ff) + 0xd800), ((codePoint & 0x3ff) + 0xdc00)); }).join(""); } function toUtf8String(bytes, onError) { return _toUtf8String(getUtf8CodePoints(bytes, onError)); } function toUtf8CodePoints(str, form = UnicodeNormalizationForm.current) { return getUtf8CodePoints(toUtf8Bytes(str, form)); } //# sourceMappingURL=utf8.js.map /***/ }), /***/ 83875: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { "TransactionTypes": function() { return /* binding */ TransactionTypes; }, "accessListify": function() { return /* binding */ accessListify; }, "computeAddress": function() { return /* binding */ computeAddress; }, "parse": function() { return /* binding */ parse; }, "recoverAddress": function() { return /* binding */ recoverAddress; }, "serialize": function() { return /* binding */ serialize; } }); // EXTERNAL MODULE: ./node_modules/@ethersproject/address/lib.esm/index.js + 1 modules var lib_esm = __webpack_require__(19485); // EXTERNAL MODULE: ./node_modules/@ethersproject/bignumber/lib.esm/bignumber.js var bignumber = __webpack_require__(2593); // EXTERNAL MODULE: ./node_modules/@ethersproject/bytes/lib.esm/index.js + 1 modules var bytes_lib_esm = __webpack_require__(16441); // EXTERNAL MODULE: ./node_modules/@ethersproject/constants/lib.esm/bignumbers.js var bignumbers = __webpack_require__(21046); // EXTERNAL MODULE: ./node_modules/@ethersproject/keccak256/lib.esm/index.js var keccak256_lib_esm = __webpack_require__(38197); // EXTERNAL MODULE: ./node_modules/@ethersproject/properties/lib.esm/index.js + 1 modules var properties_lib_esm = __webpack_require__(6881); // EXTERNAL MODULE: ./node_modules/@ethersproject/rlp/lib.esm/index.js + 1 modules var rlp_lib_esm = __webpack_require__(59052); // EXTERNAL MODULE: ./node_modules/@ethersproject/signing-key/lib.esm/index.js + 2 modules var signing_key_lib_esm = __webpack_require__(67669); // EXTERNAL MODULE: ./node_modules/@ethersproject/logger/lib.esm/index.js + 1 modules var logger_lib_esm = __webpack_require__(1581); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/transactions/lib.esm/_version.js const version = "transactions/5.6.2"; //# sourceMappingURL=_version.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/transactions/lib.esm/index.js const logger = new logger_lib_esm.Logger(version); var TransactionTypes; (function (TransactionTypes) { TransactionTypes[TransactionTypes["legacy"] = 0] = "legacy"; TransactionTypes[TransactionTypes["eip2930"] = 1] = "eip2930"; TransactionTypes[TransactionTypes["eip1559"] = 2] = "eip1559"; })(TransactionTypes || (TransactionTypes = {})); ; /////////////////////////////// function handleAddress(value) { if (value === "0x") { return null; } return (0,lib_esm.getAddress)(value); } function handleNumber(value) { if (value === "0x") { return bignumbers/* Zero */._Y; } return bignumber/* BigNumber.from */.O$.from(value); } // Legacy Transaction Fields const transactionFields = [ { name: "nonce", maxLength: 32, numeric: true }, { name: "gasPrice", maxLength: 32, numeric: true }, { name: "gasLimit", maxLength: 32, numeric: true }, { name: "to", length: 20 }, { name: "value", maxLength: 32, numeric: true }, { name: "data" }, ]; const allowedTransactionKeys = { chainId: true, data: true, gasLimit: true, gasPrice: true, nonce: true, to: true, type: true, value: true }; function computeAddress(key) { const publicKey = (0,signing_key_lib_esm.computePublicKey)(key); return (0,lib_esm.getAddress)((0,bytes_lib_esm.hexDataSlice)((0,keccak256_lib_esm.keccak256)((0,bytes_lib_esm.hexDataSlice)(publicKey, 1)), 12)); } function recoverAddress(digest, signature) { return computeAddress((0,signing_key_lib_esm.recoverPublicKey)((0,bytes_lib_esm.arrayify)(digest), signature)); } function formatNumber(value, name) { const result = (0,bytes_lib_esm.stripZeros)(bignumber/* BigNumber.from */.O$.from(value).toHexString()); if (result.length > 32) { logger.throwArgumentError("invalid length for " + name, ("transaction:" + name), value); } return result; } function accessSetify(addr, storageKeys) { return { address: (0,lib_esm.getAddress)(addr), storageKeys: (storageKeys || []).map((storageKey, index) => { if ((0,bytes_lib_esm.hexDataLength)(storageKey) !== 32) { logger.throwArgumentError("invalid access list storageKey", `accessList[${addr}:${index}]`, storageKey); } return storageKey.toLowerCase(); }) }; } function accessListify(value) { if (Array.isArray(value)) { return value.map((set, index) => { if (Array.isArray(set)) { if (set.length > 2) { logger.throwArgumentError("access list expected to be [ address, storageKeys[] ]", `value[${index}]`, set); } return accessSetify(set[0], set[1]); } return accessSetify(set.address, set.storageKeys); }); } const result = Object.keys(value).map((addr) => { const storageKeys = value[addr].reduce((accum, storageKey) => { accum[storageKey] = true; return accum; }, {}); return accessSetify(addr, Object.keys(storageKeys).sort()); }); result.sort((a, b) => (a.address.localeCompare(b.address))); return result; } function formatAccessList(value) { return accessListify(value).map((set) => [set.address, set.storageKeys]); } function _serializeEip1559(transaction, signature) { // If there is an explicit gasPrice, make sure it matches the // EIP-1559 fees; otherwise they may not understand what they // think they are setting in terms of fee. if (transaction.gasPrice != null) { const gasPrice = bignumber/* BigNumber.from */.O$.from(transaction.gasPrice); const maxFeePerGas = bignumber/* BigNumber.from */.O$.from(transaction.maxFeePerGas || 0); if (!gasPrice.eq(maxFeePerGas)) { logger.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas", "tx", { gasPrice, maxFeePerGas }); } } const fields = [ formatNumber(transaction.chainId || 0, "chainId"), formatNumber(transaction.nonce || 0, "nonce"), formatNumber(transaction.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"), formatNumber(transaction.maxFeePerGas || 0, "maxFeePerGas"), formatNumber(transaction.gasLimit || 0, "gasLimit"), ((transaction.to != null) ? (0,lib_esm.getAddress)(transaction.to) : "0x"), formatNumber(transaction.value || 0, "value"), (transaction.data || "0x"), (formatAccessList(transaction.accessList || [])) ]; if (signature) { const sig = (0,bytes_lib_esm.splitSignature)(signature); fields.push(formatNumber(sig.recoveryParam, "recoveryParam")); fields.push((0,bytes_lib_esm.stripZeros)(sig.r)); fields.push((0,bytes_lib_esm.stripZeros)(sig.s)); } return (0,bytes_lib_esm.hexConcat)(["0x02", rlp_lib_esm.encode(fields)]); } function _serializeEip2930(transaction, signature) { const fields = [ formatNumber(transaction.chainId || 0, "chainId"), formatNumber(transaction.nonce || 0, "nonce"), formatNumber(transaction.gasPrice || 0, "gasPrice"), formatNumber(transaction.gasLimit || 0, "gasLimit"), ((transaction.to != null) ? (0,lib_esm.getAddress)(transaction.to) : "0x"), formatNumber(transaction.value || 0, "value"), (transaction.data || "0x"), (formatAccessList(transaction.accessList || [])) ]; if (signature) { const sig = (0,bytes_lib_esm.splitSignature)(signature); fields.push(formatNumber(sig.recoveryParam, "recoveryParam")); fields.push((0,bytes_lib_esm.stripZeros)(sig.r)); fields.push((0,bytes_lib_esm.stripZeros)(sig.s)); } return (0,bytes_lib_esm.hexConcat)(["0x01", rlp_lib_esm.encode(fields)]); } // Legacy Transactions and EIP-155 function _serialize(transaction, signature) { (0,properties_lib_esm.checkProperties)(transaction, allowedTransactionKeys); const raw = []; transactionFields.forEach(function (fieldInfo) { let value = transaction[fieldInfo.name] || ([]); const options = {}; if (fieldInfo.numeric) { options.hexPad = "left"; } value = (0,bytes_lib_esm.arrayify)((0,bytes_lib_esm.hexlify)(value, options)); // Fixed-width field if (fieldInfo.length && value.length !== fieldInfo.length && value.length > 0) { logger.throwArgumentError("invalid length for " + fieldInfo.name, ("transaction:" + fieldInfo.name), value); } // Variable-width (with a maximum) if (fieldInfo.maxLength) { value = (0,bytes_lib_esm.stripZeros)(value); if (value.length > fieldInfo.maxLength) { logger.throwArgumentError("invalid length for " + fieldInfo.name, ("transaction:" + fieldInfo.name), value); } } raw.push((0,bytes_lib_esm.hexlify)(value)); }); let chainId = 0; if (transaction.chainId != null) { // A chainId was provided; if non-zero we'll use EIP-155 chainId = transaction.chainId; if (typeof (chainId) !== "number") { logger.throwArgumentError("invalid transaction.chainId", "transaction", transaction); } } else if (signature && !(0,bytes_lib_esm.isBytesLike)(signature) && signature.v > 28) { // No chainId provided, but the signature is signing with EIP-155; derive chainId chainId = Math.floor((signature.v - 35) / 2); } // We have an EIP-155 transaction (chainId was specified and non-zero) if (chainId !== 0) { raw.push((0,bytes_lib_esm.hexlify)(chainId)); // @TODO: hexValue? raw.push("0x"); raw.push("0x"); } // Requesting an unsigned transaction if (!signature) { return rlp_lib_esm.encode(raw); } // The splitSignature will ensure the transaction has a recoveryParam in the // case that the signTransaction function only adds a v. const sig = (0,bytes_lib_esm.splitSignature)(signature); // We pushed a chainId and null r, s on for hashing only; remove those let v = 27 + sig.recoveryParam; if (chainId !== 0) { raw.pop(); raw.pop(); raw.pop(); v += chainId * 2 + 8; // If an EIP-155 v (directly or indirectly; maybe _vs) was provided, check it! if (sig.v > 28 && sig.v !== v) { logger.throwArgumentError("transaction.chainId/signature.v mismatch", "signature", signature); } } else if (sig.v !== v) { logger.throwArgumentError("transaction.chainId/signature.v mismatch", "signature", signature); } raw.push((0,bytes_lib_esm.hexlify)(v)); raw.push((0,bytes_lib_esm.stripZeros)((0,bytes_lib_esm.arrayify)(sig.r))); raw.push((0,bytes_lib_esm.stripZeros)((0,bytes_lib_esm.arrayify)(sig.s))); return rlp_lib_esm.encode(raw); } function serialize(transaction, signature) { // Legacy and EIP-155 Transactions if (transaction.type == null || transaction.type === 0) { if (transaction.accessList != null) { logger.throwArgumentError("untyped transactions do not support accessList; include type: 1", "transaction", transaction); } return _serialize(transaction, signature); } // Typed Transactions (EIP-2718) switch (transaction.type) { case 1: return _serializeEip2930(transaction, signature); case 2: return _serializeEip1559(transaction, signature); default: break; } return logger.throwError(`unsupported transaction type: ${transaction.type}`, logger_lib_esm.Logger.errors.UNSUPPORTED_OPERATION, { operation: "serializeTransaction", transactionType: transaction.type }); } function _parseEipSignature(tx, fields, serialize) { try { const recid = handleNumber(fields[0]).toNumber(); if (recid !== 0 && recid !== 1) { throw new Error("bad recid"); } tx.v = recid; } catch (error) { logger.throwArgumentError("invalid v for transaction type: 1", "v", fields[0]); } tx.r = (0,bytes_lib_esm.hexZeroPad)(fields[1], 32); tx.s = (0,bytes_lib_esm.hexZeroPad)(fields[2], 32); try { const digest = (0,keccak256_lib_esm.keccak256)(serialize(tx)); tx.from = recoverAddress(digest, { r: tx.r, s: tx.s, recoveryParam: tx.v }); } catch (error) { } } function _parseEip1559(payload) { const transaction = rlp_lib_esm.decode(payload.slice(1)); if (transaction.length !== 9 && transaction.length !== 12) { logger.throwArgumentError("invalid component count for transaction type: 2", "payload", (0,bytes_lib_esm.hexlify)(payload)); } const maxPriorityFeePerGas = handleNumber(transaction[2]); const maxFeePerGas = handleNumber(transaction[3]); const tx = { type: 2, chainId: handleNumber(transaction[0]).toNumber(), nonce: handleNumber(transaction[1]).toNumber(), maxPriorityFeePerGas: maxPriorityFeePerGas, maxFeePerGas: maxFeePerGas, gasPrice: null, gasLimit: handleNumber(transaction[4]), to: handleAddress(transaction[5]), value: handleNumber(transaction[6]), data: transaction[7], accessList: accessListify(transaction[8]), }; // Unsigned EIP-1559 Transaction if (transaction.length === 9) { return tx; } tx.hash = (0,keccak256_lib_esm.keccak256)(payload); _parseEipSignature(tx, transaction.slice(9), _serializeEip1559); return tx; } function _parseEip2930(payload) { const transaction = rlp_lib_esm.decode(payload.slice(1)); if (transaction.length !== 8 && transaction.length !== 11) { logger.throwArgumentError("invalid component count for transaction type: 1", "payload", (0,bytes_lib_esm.hexlify)(payload)); } const tx = { type: 1, chainId: handleNumber(transaction[0]).toNumber(), nonce: handleNumber(transaction[1]).toNumber(), gasPrice: handleNumber(transaction[2]), gasLimit: handleNumber(transaction[3]), to: handleAddress(transaction[4]), value: handleNumber(transaction[5]), data: transaction[6], accessList: accessListify(transaction[7]) }; // Unsigned EIP-2930 Transaction if (transaction.length === 8) { return tx; } tx.hash = (0,keccak256_lib_esm.keccak256)(payload); _parseEipSignature(tx, transaction.slice(8), _serializeEip2930); return tx; } // Legacy Transactions and EIP-155 function _parse(rawTransaction) { const transaction = rlp_lib_esm.decode(rawTransaction); if (transaction.length !== 9 && transaction.length !== 6) { logger.throwArgumentError("invalid raw transaction", "rawTransaction", rawTransaction); } const tx = { nonce: handleNumber(transaction[0]).toNumber(), gasPrice: handleNumber(transaction[1]), gasLimit: handleNumber(transaction[2]), to: handleAddress(transaction[3]), value: handleNumber(transaction[4]), data: transaction[5], chainId: 0 }; // Legacy unsigned transaction if (transaction.length === 6) { return tx; } try { tx.v = bignumber/* BigNumber.from */.O$.from(transaction[6]).toNumber(); } catch (error) { // @TODO: What makes snese to do? The v is too big return tx; } tx.r = (0,bytes_lib_esm.hexZeroPad)(transaction[7], 32); tx.s = (0,bytes_lib_esm.hexZeroPad)(transaction[8], 32); if (bignumber/* BigNumber.from */.O$.from(tx.r).isZero() && bignumber/* BigNumber.from */.O$.from(tx.s).isZero()) { // EIP-155 unsigned transaction tx.chainId = tx.v; tx.v = 0; } else { // Signed Transaction tx.chainId = Math.floor((tx.v - 35) / 2); if (tx.chainId < 0) { tx.chainId = 0; } let recoveryParam = tx.v - 27; const raw = transaction.slice(0, 6); if (tx.chainId !== 0) { raw.push((0,bytes_lib_esm.hexlify)(tx.chainId)); raw.push("0x"); raw.push("0x"); recoveryParam -= tx.chainId * 2 + 8; } const digest = (0,keccak256_lib_esm.keccak256)(rlp_lib_esm.encode(raw)); try { tx.from = recoverAddress(digest, { r: (0,bytes_lib_esm.hexlify)(tx.r), s: (0,bytes_lib_esm.hexlify)(tx.s), recoveryParam: recoveryParam }); } catch (error) { } tx.hash = (0,keccak256_lib_esm.keccak256)(rawTransaction); } tx.type = null; return tx; } function parse(rawTransaction) { const payload = (0,bytes_lib_esm.arrayify)(rawTransaction); // Legacy and EIP-155 Transactions if (payload[0] > 0x7f) { return _parse(payload); } // Typed Transaction (EIP-2718) switch (payload[0]) { case 1: return _parseEip2930(payload); case 2: return _parseEip1559(payload); default: break; } return logger.throwError(`unsupported transaction type: ${payload[0]}`, logger_lib_esm.Logger.errors.UNSUPPORTED_OPERATION, { operation: "parseTransaction", transactionType: payload[0] }); } //# sourceMappingURL=index.js.map /***/ }), /***/ 61744: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { "commify": function() { return /* binding */ commify; }, "formatEther": function() { return /* binding */ formatEther; }, "formatUnits": function() { return /* binding */ formatUnits; }, "parseEther": function() { return /* binding */ parseEther; }, "parseUnits": function() { return /* binding */ parseUnits; } }); // EXTERNAL MODULE: ./node_modules/@ethersproject/bignumber/lib.esm/fixednumber.js var fixednumber = __webpack_require__(20335); // EXTERNAL MODULE: ./node_modules/@ethersproject/logger/lib.esm/index.js + 1 modules var lib_esm = __webpack_require__(1581); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/units/lib.esm/_version.js const version = "units/5.6.1"; //# sourceMappingURL=_version.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/units/lib.esm/index.js const logger = new lib_esm.Logger(version); const names = [ "wei", "kwei", "mwei", "gwei", "szabo", "finney", "ether", ]; // Some environments have issues with RegEx that contain back-tracking, so we cannot // use them. function commify(value) { const comps = String(value).split("."); if (comps.length > 2 || !comps[0].match(/^-?[0-9]*$/) || (comps[1] && !comps[1].match(/^[0-9]*$/)) || value === "." || value === "-.") { logger.throwArgumentError("invalid value", "value", value); } // Make sure we have at least one whole digit (0 if none) let whole = comps[0]; let negative = ""; if (whole.substring(0, 1) === "-") { negative = "-"; whole = whole.substring(1); } // Make sure we have at least 1 whole digit with no leading zeros while (whole.substring(0, 1) === "0") { whole = whole.substring(1); } if (whole === "") { whole = "0"; } let suffix = ""; if (comps.length === 2) { suffix = "." + (comps[1] || "0"); } while (suffix.length > 2 && suffix[suffix.length - 1] === "0") { suffix = suffix.substring(0, suffix.length - 1); } const formatted = []; while (whole.length) { if (whole.length <= 3) { formatted.unshift(whole); break; } else { const index = whole.length - 3; formatted.unshift(whole.substring(index)); whole = whole.substring(0, index); } } return negative + formatted.join(",") + suffix; } function formatUnits(value, unitName) { if (typeof (unitName) === "string") { const index = names.indexOf(unitName); if (index !== -1) { unitName = 3 * index; } } return (0,fixednumber/* formatFixed */.S5)(value, (unitName != null) ? unitName : 18); } function parseUnits(value, unitName) { if (typeof (value) !== "string") { logger.throwArgumentError("value must be a string", "value", value); } if (typeof (unitName) === "string") { const index = names.indexOf(unitName); if (index !== -1) { unitName = 3 * index; } } return (0,fixednumber/* parseFixed */.Ox)(value, (unitName != null) ? unitName : 18); } function formatEther(wei) { return formatUnits(wei, 18); } function parseEther(ether) { return parseUnits(ether, 18); } //# sourceMappingURL=index.js.map /***/ }), /***/ 79911: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { "Wallet": function() { return /* binding */ Wallet; }, "verifyMessage": function() { return /* binding */ verifyMessage; }, "verifyTypedData": function() { return /* binding */ verifyTypedData; } }); // EXTERNAL MODULE: ./node_modules/@ethersproject/address/lib.esm/index.js + 1 modules var lib_esm = __webpack_require__(19485); // EXTERNAL MODULE: ./node_modules/@ethersproject/abstract-provider/lib.esm/index.js + 1 modules var abstract_provider_lib_esm = __webpack_require__(81556); // EXTERNAL MODULE: ./node_modules/@ethersproject/abstract-signer/lib.esm/index.js + 1 modules var abstract_signer_lib_esm = __webpack_require__(48088); // EXTERNAL MODULE: ./node_modules/@ethersproject/bytes/lib.esm/index.js + 1 modules var bytes_lib_esm = __webpack_require__(16441); // EXTERNAL MODULE: ./node_modules/@ethersproject/hash/lib.esm/message.js var lib_esm_message = __webpack_require__(93684); // EXTERNAL MODULE: ./node_modules/@ethersproject/hash/lib.esm/typed-data.js var typed_data = __webpack_require__(67827); // EXTERNAL MODULE: ./node_modules/@ethersproject/hdnode/lib.esm/index.js + 1 modules var hdnode_lib_esm = __webpack_require__(84178); // EXTERNAL MODULE: ./node_modules/@ethersproject/keccak256/lib.esm/index.js var keccak256_lib_esm = __webpack_require__(38197); // EXTERNAL MODULE: ./node_modules/@ethersproject/properties/lib.esm/index.js + 1 modules var properties_lib_esm = __webpack_require__(6881); // EXTERNAL MODULE: ./node_modules/@ethersproject/random/lib.esm/random.js + 1 modules var random = __webpack_require__(5634); // EXTERNAL MODULE: ./node_modules/@ethersproject/signing-key/lib.esm/index.js + 2 modules var signing_key_lib_esm = __webpack_require__(67669); // EXTERNAL MODULE: ./node_modules/@ethersproject/json-wallets/lib.esm/keystore.js var keystore = __webpack_require__(81964); // EXTERNAL MODULE: ./node_modules/@ethersproject/json-wallets/lib.esm/index.js + 1 modules var json_wallets_lib_esm = __webpack_require__(64341); // EXTERNAL MODULE: ./node_modules/@ethersproject/transactions/lib.esm/index.js + 1 modules var transactions_lib_esm = __webpack_require__(83875); // EXTERNAL MODULE: ./node_modules/@ethersproject/logger/lib.esm/index.js + 1 modules var logger_lib_esm = __webpack_require__(1581); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/wallet/lib.esm/_version.js const version = "wallet/5.6.2"; //# sourceMappingURL=_version.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/wallet/lib.esm/index.js var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; const logger = new logger_lib_esm.Logger(version); function isAccount(value) { return (value != null && (0,bytes_lib_esm.isHexString)(value.privateKey, 32) && value.address != null); } function hasMnemonic(value) { const mnemonic = value.mnemonic; return (mnemonic && mnemonic.phrase); } class Wallet extends abstract_signer_lib_esm.Signer { constructor(privateKey, provider) { super(); if (isAccount(privateKey)) { const signingKey = new signing_key_lib_esm.SigningKey(privateKey.privateKey); (0,properties_lib_esm.defineReadOnly)(this, "_signingKey", () => signingKey); (0,properties_lib_esm.defineReadOnly)(this, "address", (0,transactions_lib_esm.computeAddress)(this.publicKey)); if (this.address !== (0,lib_esm.getAddress)(privateKey.address)) { logger.throwArgumentError("privateKey/address mismatch", "privateKey", "[REDACTED]"); } if (hasMnemonic(privateKey)) { const srcMnemonic = privateKey.mnemonic; (0,properties_lib_esm.defineReadOnly)(this, "_mnemonic", () => ({ phrase: srcMnemonic.phrase, path: srcMnemonic.path || hdnode_lib_esm.defaultPath, locale: srcMnemonic.locale || "en" })); const mnemonic = this.mnemonic; const node = hdnode_lib_esm.HDNode.fromMnemonic(mnemonic.phrase, null, mnemonic.locale).derivePath(mnemonic.path); if ((0,transactions_lib_esm.computeAddress)(node.privateKey) !== this.address) { logger.throwArgumentError("mnemonic/address mismatch", "privateKey", "[REDACTED]"); } } else { (0,properties_lib_esm.defineReadOnly)(this, "_mnemonic", () => null); } } else { if (signing_key_lib_esm.SigningKey.isSigningKey(privateKey)) { /* istanbul ignore if */ if (privateKey.curve !== "secp256k1") { logger.throwArgumentError("unsupported curve; must be secp256k1", "privateKey", "[REDACTED]"); } (0,properties_lib_esm.defineReadOnly)(this, "_signingKey", () => privateKey); } else { // A lot of common tools do not prefix private keys with a 0x (see: #1166) if (typeof (privateKey) === "string") { if (privateKey.match(/^[0-9a-f]*$/i) && privateKey.length === 64) { privateKey = "0x" + privateKey; } } const signingKey = new signing_key_lib_esm.SigningKey(privateKey); (0,properties_lib_esm.defineReadOnly)(this, "_signingKey", () => signingKey); } (0,properties_lib_esm.defineReadOnly)(this, "_mnemonic", () => null); (0,properties_lib_esm.defineReadOnly)(this, "address", (0,transactions_lib_esm.computeAddress)(this.publicKey)); } /* istanbul ignore if */ if (provider && !abstract_provider_lib_esm.Provider.isProvider(provider)) { logger.throwArgumentError("invalid provider", "provider", provider); } (0,properties_lib_esm.defineReadOnly)(this, "provider", provider || null); } get mnemonic() { return this._mnemonic(); } get privateKey() { return this._signingKey().privateKey; } get publicKey() { return this._signingKey().publicKey; } getAddress() { return Promise.resolve(this.address); } connect(provider) { return new Wallet(this, provider); } signTransaction(transaction) { return (0,properties_lib_esm.resolveProperties)(transaction).then((tx) => { if (tx.from != null) { if ((0,lib_esm.getAddress)(tx.from) !== this.address) { logger.throwArgumentError("transaction from address mismatch", "transaction.from", transaction.from); } delete tx.from; } const signature = this._signingKey().signDigest((0,keccak256_lib_esm.keccak256)((0,transactions_lib_esm.serialize)(tx))); return (0,transactions_lib_esm.serialize)(tx, signature); }); } signMessage(message) { return __awaiter(this, void 0, void 0, function* () { return (0,bytes_lib_esm.joinSignature)(this._signingKey().signDigest((0,lib_esm_message/* hashMessage */.r)(message))); }); } _signTypedData(domain, types, value) { return __awaiter(this, void 0, void 0, function* () { // Populate any ENS names const populated = yield typed_data/* TypedDataEncoder.resolveNames */.E.resolveNames(domain, types, value, (name) => { if (this.provider == null) { logger.throwError("cannot resolve ENS names without a provider", logger_lib_esm.Logger.errors.UNSUPPORTED_OPERATION, { operation: "resolveName", value: name }); } return this.provider.resolveName(name); }); return (0,bytes_lib_esm.joinSignature)(this._signingKey().signDigest(typed_data/* TypedDataEncoder.hash */.E.hash(populated.domain, types, populated.value))); }); } encrypt(password, options, progressCallback) { if (typeof (options) === "function" && !progressCallback) { progressCallback = options; options = {}; } if (progressCallback && typeof (progressCallback) !== "function") { throw new Error("invalid callback"); } if (!options) { options = {}; } return (0,keystore/* encrypt */.HI)(this, password, options, progressCallback); } /** * Static methods to create Wallet instances. */ static createRandom(options) { let entropy = (0,random/* randomBytes */.O)(16); if (!options) { options = {}; } if (options.extraEntropy) { entropy = (0,bytes_lib_esm.arrayify)((0,bytes_lib_esm.hexDataSlice)((0,keccak256_lib_esm.keccak256)((0,bytes_lib_esm.concat)([entropy, options.extraEntropy])), 0, 16)); } const mnemonic = (0,hdnode_lib_esm.entropyToMnemonic)(entropy, options.locale); return Wallet.fromMnemonic(mnemonic, options.path, options.locale); } static fromEncryptedJson(json, password, progressCallback) { return (0,json_wallets_lib_esm.decryptJsonWallet)(json, password, progressCallback).then((account) => { return new Wallet(account); }); } static fromEncryptedJsonSync(json, password) { return new Wallet((0,json_wallets_lib_esm.decryptJsonWalletSync)(json, password)); } static fromMnemonic(mnemonic, path, wordlist) { if (!path) { path = hdnode_lib_esm.defaultPath; } return new Wallet(hdnode_lib_esm.HDNode.fromMnemonic(mnemonic, null, wordlist).derivePath(path)); } } function verifyMessage(message, signature) { return (0,transactions_lib_esm.recoverAddress)((0,lib_esm_message/* hashMessage */.r)(message), signature); } function verifyTypedData(domain, types, value, signature) { return (0,transactions_lib_esm.recoverAddress)(typed_data/* TypedDataEncoder.hash */.E.hash(domain, types, value), signature); } //# sourceMappingURL=index.js.map /***/ }), /***/ 37707: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { "_fetchData": function() { return /* binding */ _fetchData; }, "fetchJson": function() { return /* binding */ fetchJson; }, "poll": function() { return /* binding */ poll; } }); // EXTERNAL MODULE: ./node_modules/@ethersproject/base64/lib.esm/base64.js var base64 = __webpack_require__(59567); // EXTERNAL MODULE: ./node_modules/@ethersproject/bytes/lib.esm/index.js + 1 modules var lib_esm = __webpack_require__(16441); // EXTERNAL MODULE: ./node_modules/@ethersproject/properties/lib.esm/index.js + 1 modules var properties_lib_esm = __webpack_require__(6881); // EXTERNAL MODULE: ./node_modules/@ethersproject/strings/lib.esm/utf8.js + 1 modules var utf8 = __webpack_require__(29251); // EXTERNAL MODULE: ./node_modules/@ethersproject/logger/lib.esm/index.js + 1 modules var logger_lib_esm = __webpack_require__(1581); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/web/lib.esm/_version.js const version = "web/5.6.1"; //# sourceMappingURL=_version.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/web/lib.esm/geturl.js var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; function getUrl(href, options) { return __awaiter(this, void 0, void 0, function* () { if (options == null) { options = {}; } const request = { method: (options.method || "GET"), headers: (options.headers || {}), body: (options.body || undefined), }; if (options.skipFetchSetup !== true) { request.mode = "cors"; // no-cors, cors, *same-origin request.cache = "no-cache"; // *default, no-cache, reload, force-cache, only-if-cached request.credentials = "same-origin"; // include, *same-origin, omit request.redirect = "follow"; // manual, *follow, error request.referrer = "client"; // no-referrer, *client } ; const response = yield fetch(href, request); const body = yield response.arrayBuffer(); const headers = {}; if (response.headers.forEach) { response.headers.forEach((value, key) => { headers[key.toLowerCase()] = value; }); } else { ((response.headers).keys)().forEach((key) => { headers[key.toLowerCase()] = response.headers.get(key); }); } return { headers: headers, statusCode: response.status, statusMessage: response.statusText, body: (0,lib_esm.arrayify)(new Uint8Array(body)), }; }); } //# sourceMappingURL=geturl.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/web/lib.esm/index.js var lib_esm_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; const logger = new logger_lib_esm.Logger(version); function staller(duration) { return new Promise((resolve) => { setTimeout(resolve, duration); }); } function bodyify(value, type) { if (value == null) { return null; } if (typeof (value) === "string") { return value; } if ((0,lib_esm.isBytesLike)(value)) { if (type && (type.split("/")[0] === "text" || type.split(";")[0].trim() === "application/json")) { try { return (0,utf8/* toUtf8String */.ZN)(value); } catch (error) { } ; } return (0,lib_esm.hexlify)(value); } return value; } // This API is still a work in progress; the future changes will likely be: // - ConnectionInfo => FetchDataRequest // - FetchDataRequest.body? = string | Uint8Array | { contentType: string, data: string | Uint8Array } // - If string => text/plain, Uint8Array => application/octet-stream (if content-type unspecified) // - FetchDataRequest.processFunc = (body: Uint8Array, response: FetchDataResponse) => T // For this reason, it should be considered internal until the API is finalized function _fetchData(connection, body, processFunc) { // How many times to retry in the event of a throttle const attemptLimit = (typeof (connection) === "object" && connection.throttleLimit != null) ? connection.throttleLimit : 12; logger.assertArgument((attemptLimit > 0 && (attemptLimit % 1) === 0), "invalid connection throttle limit", "connection.throttleLimit", attemptLimit); const throttleCallback = ((typeof (connection) === "object") ? connection.throttleCallback : null); const throttleSlotInterval = ((typeof (connection) === "object" && typeof (connection.throttleSlotInterval) === "number") ? connection.throttleSlotInterval : 100); logger.assertArgument((throttleSlotInterval > 0 && (throttleSlotInterval % 1) === 0), "invalid connection throttle slot interval", "connection.throttleSlotInterval", throttleSlotInterval); const errorPassThrough = ((typeof (connection) === "object") ? !!(connection.errorPassThrough) : false); const headers = {}; let url = null; // @TODO: Allow ConnectionInfo to override some of these values const options = { method: "GET", }; let allow304 = false; let timeout = 2 * 60 * 1000; if (typeof (connection) === "string") { url = connection; } else if (typeof (connection) === "object") { if (connection == null || connection.url == null) { logger.throwArgumentError("missing URL", "connection.url", connection); } url = connection.url; if (typeof (connection.timeout) === "number" && connection.timeout > 0) { timeout = connection.timeout; } if (connection.headers) { for (const key in connection.headers) { headers[key.toLowerCase()] = { key: key, value: String(connection.headers[key]) }; if (["if-none-match", "if-modified-since"].indexOf(key.toLowerCase()) >= 0) { allow304 = true; } } } options.allowGzip = !!connection.allowGzip; if (connection.user != null && connection.password != null) { if (url.substring(0, 6) !== "https:" && connection.allowInsecureAuthentication !== true) { logger.throwError("basic authentication requires a secure https url", logger_lib_esm.Logger.errors.INVALID_ARGUMENT, { argument: "url", url: url, user: connection.user, password: "[REDACTED]" }); } const authorization = connection.user + ":" + connection.password; headers["authorization"] = { key: "Authorization", value: "Basic " + (0,base64/* encode */.c)((0,utf8/* toUtf8Bytes */.Y0)(authorization)) }; } if (connection.skipFetchSetup != null) { options.skipFetchSetup = !!connection.skipFetchSetup; } } const reData = new RegExp("^data:([a-z0-9-]+/[a-z0-9-]+);base64,(.*)$", "i"); const dataMatch = ((url) ? url.match(reData) : null); if (dataMatch) { try { const response = { statusCode: 200, statusMessage: "OK", headers: { "content-type": dataMatch[1] }, body: (0,base64/* decode */.J)(dataMatch[2]) }; let result = response.body; if (processFunc) { result = processFunc(response.body, response); } return Promise.resolve(result); } catch (error) { logger.throwError("processing response error", logger_lib_esm.Logger.errors.SERVER_ERROR, { body: bodyify(dataMatch[1], dataMatch[2]), error: error, requestBody: null, requestMethod: "GET", url: url }); } } if (body) { options.method = "POST"; options.body = body; if (headers["content-type"] == null) { headers["content-type"] = { key: "Content-Type", value: "application/octet-stream" }; } if (headers["content-length"] == null) { headers["content-length"] = { key: "Content-Length", value: String(body.length) }; } } const flatHeaders = {}; Object.keys(headers).forEach((key) => { const header = headers[key]; flatHeaders[header.key] = header.value; }); options.headers = flatHeaders; const runningTimeout = (function () { let timer = null; const promise = new Promise(function (resolve, reject) { if (timeout) { timer = setTimeout(() => { if (timer == null) { return; } timer = null; reject(logger.makeError("timeout", logger_lib_esm.Logger.errors.TIMEOUT, { requestBody: bodyify(options.body, flatHeaders["content-type"]), requestMethod: options.method, timeout: timeout, url: url })); }, timeout); } }); const cancel = function () { if (timer == null) { return; } clearTimeout(timer); timer = null; }; return { promise, cancel }; })(); const runningFetch = (function () { return lib_esm_awaiter(this, void 0, void 0, function* () { for (let attempt = 0; attempt < attemptLimit; attempt++) { let response = null; try { response = yield getUrl(url, options); if (attempt < attemptLimit) { if (response.statusCode === 301 || response.statusCode === 302) { // Redirection; for now we only support absolute locataions const location = response.headers.location || ""; if (options.method === "GET" && location.match(/^https:/)) { url = response.headers.location; continue; } } else if (response.statusCode === 429) { // Exponential back-off throttling let tryAgain = true; if (throttleCallback) { tryAgain = yield throttleCallback(attempt, url); } if (tryAgain) { let stall = 0; const retryAfter = response.headers["retry-after"]; if (typeof (retryAfter) === "string" && retryAfter.match(/^[1-9][0-9]*$/)) { stall = parseInt(retryAfter) * 1000; } else { stall = throttleSlotInterval * parseInt(String(Math.random() * Math.pow(2, attempt))); } //console.log("Stalling 429"); yield staller(stall); continue; } } } } catch (error) { response = error.response; if (response == null) { runningTimeout.cancel(); logger.throwError("missing response", logger_lib_esm.Logger.errors.SERVER_ERROR, { requestBody: bodyify(options.body, flatHeaders["content-type"]), requestMethod: options.method, serverError: error, url: url }); } } let body = response.body; if (allow304 && response.statusCode === 304) { body = null; } else if (!errorPassThrough && (response.statusCode < 200 || response.statusCode >= 300)) { runningTimeout.cancel(); logger.throwError("bad response", logger_lib_esm.Logger.errors.SERVER_ERROR, { status: response.statusCode, headers: response.headers, body: bodyify(body, ((response.headers) ? response.headers["content-type"] : null)), requestBody: bodyify(options.body, flatHeaders["content-type"]), requestMethod: options.method, url: url }); } if (processFunc) { try { const result = yield processFunc(body, response); runningTimeout.cancel(); return result; } catch (error) { // Allow the processFunc to trigger a throttle if (error.throttleRetry && attempt < attemptLimit) { let tryAgain = true; if (throttleCallback) { tryAgain = yield throttleCallback(attempt, url); } if (tryAgain) { const timeout = throttleSlotInterval * parseInt(String(Math.random() * Math.pow(2, attempt))); //console.log("Stalling callback"); yield staller(timeout); continue; } } runningTimeout.cancel(); logger.throwError("processing response error", logger_lib_esm.Logger.errors.SERVER_ERROR, { body: bodyify(body, ((response.headers) ? response.headers["content-type"] : null)), error: error, requestBody: bodyify(options.body, flatHeaders["content-type"]), requestMethod: options.method, url: url }); } } runningTimeout.cancel(); // If we had a processFunc, it either returned a T or threw above. // The "body" is now a Uint8Array. return body; } return logger.throwError("failed response", logger_lib_esm.Logger.errors.SERVER_ERROR, { requestBody: bodyify(options.body, flatHeaders["content-type"]), requestMethod: options.method, url: url }); }); })(); return Promise.race([runningTimeout.promise, runningFetch]); } function fetchJson(connection, json, processFunc) { let processJsonFunc = (value, response) => { let result = null; if (value != null) { try { result = JSON.parse((0,utf8/* toUtf8String */.ZN)(value)); } catch (error) { logger.throwError("invalid JSON", logger_lib_esm.Logger.errors.SERVER_ERROR, { body: value, error: error }); } } if (processFunc) { result = processFunc(result, response); } return result; }; // If we have json to send, we must // - add content-type of application/json (unless already overridden) // - convert the json to bytes let body = null; if (json != null) { body = (0,utf8/* toUtf8Bytes */.Y0)(json); // Create a connection with the content-type set for JSON const updated = (typeof (connection) === "string") ? ({ url: connection }) : (0,properties_lib_esm.shallowCopy)(connection); if (updated.headers) { const hasContentType = (Object.keys(updated.headers).filter((k) => (k.toLowerCase() === "content-type")).length) !== 0; if (!hasContentType) { updated.headers = (0,properties_lib_esm.shallowCopy)(updated.headers); updated.headers["content-type"] = "application/json"; } } else { updated.headers = { "content-type": "application/json" }; } connection = updated; } return _fetchData(connection, body, processJsonFunc); } function poll(func, options) { if (!options) { options = {}; } options = (0,properties_lib_esm.shallowCopy)(options); if (options.floor == null) { options.floor = 0; } if (options.ceiling == null) { options.ceiling = 10000; } if (options.interval == null) { options.interval = 250; } return new Promise(function (resolve, reject) { let timer = null; let done = false; // Returns true if cancel was successful. Unsuccessful cancel means we're already done. const cancel = () => { if (done) { return false; } done = true; if (timer) { clearTimeout(timer); } return true; }; if (options.timeout) { timer = setTimeout(() => { if (cancel()) { reject(new Error("timeout")); } }, options.timeout); } const retryLimit = options.retryLimit; let attempt = 0; function check() { return func().then(function (result) { // If we have a result, or are allowed null then we're done if (result !== undefined) { if (cancel()) { resolve(result); } } else if (options.oncePoll) { options.oncePoll.once("poll", check); } else if (options.onceBlock) { options.onceBlock.once("block", check); // Otherwise, exponential back-off (up to 10s) our next request } else if (!done) { attempt++; if (attempt > retryLimit) { if (cancel()) { reject(new Error("retry limit reached")); } return; } let timeout = options.interval * parseInt(String(Math.random() * Math.pow(2, attempt))); if (timeout < options.floor) { timeout = options.floor; } if (timeout > options.ceiling) { timeout = options.ceiling; } setTimeout(check, timeout); } return null; }, function (error) { if (cancel()) { reject(error); } }); } check(); }); } //# sourceMappingURL=index.js.map /***/ }), /***/ 78435: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Wordlist": function() { return /* reexport safe */ _wordlist__WEBPACK_IMPORTED_MODULE_0__.D; }, /* harmony export */ "logger": function() { return /* reexport safe */ _wordlist__WEBPACK_IMPORTED_MODULE_0__.k; }, /* harmony export */ "wordlists": function() { return /* reexport safe */ _wordlists__WEBPACK_IMPORTED_MODULE_1__.E; } /* harmony export */ }); /* harmony import */ var _wordlist__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(48812); /* harmony import */ var _wordlists__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(10234); // Wordlists // See: https://github.com/bitcoin/bips/blob/master/bip-0039/bip-0039-wordlists.md //# sourceMappingURL=index.js.map /***/ }), /***/ 48812: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { "D": function() { return /* binding */ Wordlist; }, "k": function() { return /* binding */ logger; } }); // EXTERNAL MODULE: ./node_modules/@ethersproject/hash/lib.esm/id.js var id = __webpack_require__(32046); // EXTERNAL MODULE: ./node_modules/@ethersproject/properties/lib.esm/index.js + 1 modules var lib_esm = __webpack_require__(6881); // EXTERNAL MODULE: ./node_modules/@ethersproject/logger/lib.esm/index.js + 1 modules var logger_lib_esm = __webpack_require__(1581); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/wordlists/lib.esm/_version.js const version = "wordlists/5.6.1"; //# sourceMappingURL=_version.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/wordlists/lib.esm/wordlist.js // This gets overridden by rollup const exportWordlist = false; const logger = new logger_lib_esm.Logger(version); class Wordlist { constructor(locale) { logger.checkAbstract(new.target, Wordlist); (0,lib_esm.defineReadOnly)(this, "locale", locale); } // Subclasses may override this split(mnemonic) { return mnemonic.toLowerCase().split(/ +/g); } // Subclasses may override this join(words) { return words.join(" "); } static check(wordlist) { const words = []; for (let i = 0; i < 2048; i++) { const word = wordlist.getWord(i); /* istanbul ignore if */ if (i !== wordlist.getWordIndex(word)) { return "0x"; } words.push(word); } return (0,id.id)(words.join("\n") + "\n"); } static register(lang, name) { if (!name) { name = lang.locale; } /* istanbul ignore if */ if (exportWordlist) { try { const anyGlobal = window; if (anyGlobal._ethers && anyGlobal._ethers.wordlists) { if (!anyGlobal._ethers.wordlists[name]) { (0,lib_esm.defineReadOnly)(anyGlobal._ethers.wordlists, name, lang); } } } catch (error) { } } } } //# sourceMappingURL=wordlist.js.map /***/ }), /***/ 10234: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { "E": function() { return /* binding */ wordlists; } }); // EXTERNAL MODULE: ./node_modules/@ethersproject/wordlists/lib.esm/wordlist.js + 1 modules var wordlist = __webpack_require__(48812); ;// CONCATENATED MODULE: ./node_modules/@ethersproject/wordlists/lib.esm/lang-en.js const words = "AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo"; let lang_en_wordlist = null; function loadWords(lang) { if (lang_en_wordlist != null) { return; } lang_en_wordlist = words.replace(/([A-Z])/g, " $1").toLowerCase().substring(1).split(" "); // Verify the computed list matches the official list /* istanbul ignore if */ if (wordlist/* Wordlist.check */.D.check(lang) !== "0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60") { lang_en_wordlist = null; throw new Error("BIP39 Wordlist for en (English) FAILED"); } } class LangEn extends wordlist/* Wordlist */.D { constructor() { super("en"); } getWord(index) { loadWords(this); return lang_en_wordlist[index]; } getWordIndex(word) { loadWords(this); return lang_en_wordlist.indexOf(word); } } const langEn = new LangEn(); wordlist/* Wordlist.register */.D.register(langEn); //# sourceMappingURL=lang-en.js.map ;// CONCATENATED MODULE: ./node_modules/@ethersproject/wordlists/lib.esm/wordlists.js const wordlists = { en: langEn }; //# sourceMappingURL=wordlists.js.map /***/ }), /***/ 96844: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.SafeAppProvider = void 0; var provider_1 = __webpack_require__(26221); Object.defineProperty(exports, "SafeAppProvider", ({ enumerable: true, get: function () { return provider_1.SafeAppProvider; } })); //# sourceMappingURL=index.js.map /***/ }), /***/ 26221: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.SafeAppProvider = void 0; const events_1 = __webpack_require__(17187); const utils_1 = __webpack_require__(11509); // The API is based on Ethereum JavaScript API Provider Standard. Link: https://eips.ethereum.org/EIPS/eip-1193 class SafeAppProvider extends events_1.EventEmitter { constructor(safe, sdk) { super(); this.submittedTxs = new Map(); this.safe = safe; this.sdk = sdk; } async connect() { this.emit('connect', { chainId: this.chainId }); return; } async disconnect() { return; } get chainId() { return this.safe.chainId; } // eslint-disable-next-line @typescript-eslint/no-explicit-any async request(request) { const { method, params = [] } = request; switch (method) { case 'eth_accounts': return [this.safe.safeAddress]; case 'net_version': case 'eth_chainId': return `0x${this.chainId.toString(16)}`; case 'personal_sign': { const [message, address] = params; if (this.safe.safeAddress.toLowerCase() !== address.toLowerCase()) { throw new Error('The address or message hash is invalid'); } await this.sdk.txs.signMessage(message); return '0x'; } case 'eth_sign': { const [address, messageHash] = params; if (this.safe.safeAddress.toLowerCase() !== address.toLowerCase() || !messageHash.startsWith('0x')) { throw new Error('The address or message hash is invalid'); } await this.sdk.txs.signMessage(messageHash); return '0x'; } case 'eth_sendTransaction': const tx = Object.assign({ value: '0', data: '0x' }, params[0]); const resp = await this.sdk.txs.send({ txs: [tx], }); // Store fake transaction this.submittedTxs.set(resp.safeTxHash, { from: this.safe.safeAddress, hash: resp.safeTxHash, gas: 0, gasPrice: '0x00', nonce: 0, input: tx.data, value: tx.value, to: tx.to, blockHash: null, blockNumber: null, transactionIndex: null, }); return resp.safeTxHash; case 'eth_blockNumber': const block = await this.sdk.eth.getBlockByNumber(['latest']); return block.number; case 'eth_getBalance': return this.sdk.eth.getBalance([(0, utils_1.getLowerCase)(params[0]), params[1]]); case 'eth_getCode': return this.sdk.eth.getCode([(0, utils_1.getLowerCase)(params[0]), params[1]]); case 'eth_getTransactionCount': return this.sdk.eth.getTransactionCount([(0, utils_1.getLowerCase)(params[0]), params[1]]); case 'eth_getStorageAt': return this.sdk.eth.getStorageAt([(0, utils_1.getLowerCase)(params[0]), params[1], params[2]]); case 'eth_getBlockByNumber': return this.sdk.eth.getBlockByNumber([params[0], params[1]]); case 'eth_getBlockByHash': return this.sdk.eth.getBlockByHash([params[0], params[1]]); case 'eth_getTransactionByHash': let txHash = params[0]; try { const resp = await this.sdk.txs.getBySafeTxHash(txHash); txHash = resp.txHash || txHash; } catch (e) { } // Use fake transaction if we don't have a real tx hash if (this.submittedTxs.has(txHash)) { return this.submittedTxs.get(txHash); } return this.sdk.eth.getTransactionByHash([txHash]).then((tx) => { // We set the tx hash to the one requested, as some provider assert this if (tx) { tx.hash = params[0]; } return tx; }); case 'eth_getTransactionReceipt': { let txHash = params[0]; try { const resp = await this.sdk.txs.getBySafeTxHash(txHash); txHash = resp.txHash || txHash; } catch (e) { } return this.sdk.eth.getTransactionReceipt([txHash]).then((tx) => { // We set the tx hash to the one requested, as some provider assert this if (tx) { tx.transactionHash = params[0]; } return tx; }); } case 'eth_estimateGas': { return this.sdk.eth.getEstimateGas(params[0]); } case 'eth_call': { return this.sdk.eth.call([params[0], params[1]]); } case 'eth_getLogs': return this.sdk.eth.getPastLogs([params[0]]); case 'eth_gasPrice': return this.sdk.eth.getGasPrice(); case 'wallet_getPermissions': return this.sdk.wallet.getPermissions(); case 'wallet_requestPermissions': return this.sdk.wallet.requestPermissions(params[0]); default: throw Error(`"${request.method}" not implemented`); } } // this method is needed for ethers v4 // https://github.com/ethers-io/ethers.js/blob/427e16826eb15d52d25c4f01027f8db22b74b76c/src.ts/providers/web3-provider.ts#L41-L55 send(request, callback) { if (!request) callback('Undefined request'); this.request(request) .then((result) => callback(null, { jsonrpc: '2.0', id: request.id, result })) .catch((error) => callback(error, null)); } } exports.SafeAppProvider = SafeAppProvider; //# sourceMappingURL=provider.js.map /***/ }), /***/ 11509: /***/ (function(__unused_webpack_module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getLowerCase = void 0; function getLowerCase(value) { if (value) { return value.toLowerCase(); } return value; } exports.getLowerCase = getLowerCase; //# sourceMappingURL=utils.js.map /***/ }), /***/ 55621: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", ({ value: true })); const messageFormatter_1 = __webpack_require__(36750); class PostMessageCommunicator { constructor(allowedOrigins = null, debugMode = false) { this.allowedOrigins = null; this.callbacks = new Map(); this.debugMode = false; this.isServer = typeof window === 'undefined'; this.isValidMessage = ({ origin, data, source }) => { const emptyOrMalformed = !data; const sentFromParentEl = !this.isServer && source === window.parent; const majorVersionNumber = typeof data.version !== 'undefined' && parseInt(data.version.split('.')[0]); const allowedSDKVersion = majorVersionNumber >= 1; let validOrigin = true; if (Array.isArray(this.allowedOrigins)) { validOrigin = this.allowedOrigins.find((regExp) => regExp.test(origin)) !== undefined; } return !emptyOrMalformed && sentFromParentEl && allowedSDKVersion && validOrigin; }; this.logIncomingMessage = (msg) => { console.info(`Safe Apps SDK v1: A message was received from origin ${msg.origin}. `, msg.data); }; this.onParentMessage = (msg) => { if (this.isValidMessage(msg)) { this.debugMode && this.logIncomingMessage(msg); this.handleIncomingMessage(msg.data); } }; this.handleIncomingMessage = (payload) => { const { id } = payload; const cb = this.callbacks.get(id); if (cb) { cb(payload); this.callbacks.delete(id); } }; this.send = (method, params) => { const request = messageFormatter_1.MessageFormatter.makeRequest(method, params); if (this.isServer) { throw new Error("Window doesn't exist"); } window.parent.postMessage(request, '*'); return new Promise((resolve, reject) => { this.callbacks.set(request.id, (response) => { if (!response.success) { reject(new Error(response.error)); return; } resolve(response); }); }); }; this.allowedOrigins = allowedOrigins; this.debugMode = debugMode; if (!this.isServer) { window.addEventListener('message', this.onParentMessage); } } } exports["default"] = PostMessageCommunicator; __exportStar(__webpack_require__(92628), exports); //# sourceMappingURL=index.js.map /***/ }), /***/ 36750: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.MessageFormatter = void 0; const utils_1 = __webpack_require__(56036); const utils_2 = __webpack_require__(78855); class MessageFormatter { } exports.MessageFormatter = MessageFormatter; MessageFormatter.makeRequest = (method, params) => { const id = (0, utils_2.generateRequestId)(); return { id, method, params, env: { sdkVersion: (0, utils_1.getSDKVersion)(), }, }; }; MessageFormatter.makeResponse = (id, data, version) => ({ id, success: true, version, data, }); MessageFormatter.makeErrorResponse = (id, error, version) => ({ id, success: false, error, version, }); //# sourceMappingURL=messageFormatter.js.map /***/ }), /***/ 92628: /***/ (function(__unused_webpack_module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.RestrictedMethods = exports.Methods = void 0; var Methods; (function (Methods) { Methods["sendTransactions"] = "sendTransactions"; Methods["rpcCall"] = "rpcCall"; Methods["getChainInfo"] = "getChainInfo"; Methods["getSafeInfo"] = "getSafeInfo"; Methods["getTxBySafeTxHash"] = "getTxBySafeTxHash"; Methods["getSafeBalances"] = "getSafeBalances"; Methods["signMessage"] = "signMessage"; Methods["getEnvironmentInfo"] = "getEnvironmentInfo"; Methods["requestAddressBook"] = "requestAddressBook"; Methods["wallet_getPermissions"] = "wallet_getPermissions"; Methods["wallet_requestPermissions"] = "wallet_requestPermissions"; })(Methods = exports.Methods || (exports.Methods = {})); var RestrictedMethods; (function (RestrictedMethods) { RestrictedMethods["requestAddressBook"] = "requestAddressBook"; })(RestrictedMethods = exports.RestrictedMethods || (exports.RestrictedMethods = {})); //# sourceMappingURL=methods.js.map /***/ }), /***/ 78855: /***/ (function(__unused_webpack_module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.generateRequestId = void 0; // i.e. 0-255 -> '00'-'ff' const dec2hex = (dec) => dec.toString(16).padStart(2, '0'); const generateId = (len) => { const arr = new Uint8Array((len || 40) / 2); window.crypto.getRandomValues(arr); return Array.from(arr, dec2hex).join(''); }; const generateRequestId = () => { if (typeof window !== 'undefined') { return generateId(10); } return new Date().getTime().toString(36); }; exports.generateRequestId = generateRequestId; //# sourceMappingURL=utils.js.map /***/ }), /***/ 2415: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const wallet_1 = __webpack_require__(55001); const permissions_1 = __webpack_require__(95238); const hasPermission = (required, permissions) => permissions.some((permission) => permission.parentCapability === required); const requirePermission = () => (_, propertyKey, descriptor) => { const originalMethod = descriptor.value; descriptor.value = async function () { // @ts-expect-error accessing private property from decorator. 'this' context is the class instance const wallet = new wallet_1.Wallet(this.communicator); let currentPermissions = await wallet.getPermissions(); if (!hasPermission(propertyKey, currentPermissions)) { currentPermissions = await wallet.requestPermissions([{ [propertyKey]: {} }]); } if (!hasPermission(propertyKey, currentPermissions)) { throw new permissions_1.PermissionsError('Permissions rejected', permissions_1.PERMISSIONS_REQUEST_REJECTED); } return originalMethod.apply(this); }; return descriptor; }; exports["default"] = requirePermission; //# sourceMappingURL=requirePermissions.js.map /***/ }), /***/ 71068: /***/ (function(__unused_webpack_module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.RPC_CALLS = void 0; exports.RPC_CALLS = { eth_call: 'eth_call', eth_gasPrice: 'eth_gasPrice', eth_getLogs: 'eth_getLogs', eth_getBalance: 'eth_getBalance', eth_getCode: 'eth_getCode', eth_getBlockByHash: 'eth_getBlockByHash', eth_getBlockByNumber: 'eth_getBlockByNumber', eth_getStorageAt: 'eth_getStorageAt', eth_getTransactionByHash: 'eth_getTransactionByHash', eth_getTransactionReceipt: 'eth_getTransactionReceipt', eth_getTransactionCount: 'eth_getTransactionCount', eth_estimateGas: 'eth_estimateGas', }; //# sourceMappingURL=constants.js.map /***/ }), /***/ 60770: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Eth = void 0; const constants_1 = __webpack_require__(71068); const methods_1 = __webpack_require__(92628); const inputFormatters = { defaultBlockParam: (arg = 'latest') => arg, returnFullTxObjectParam: (arg = false) => arg, blockNumberToHex: (arg) => Number.isInteger(arg) ? `0x${arg.toString(16)}` : arg, }; class Eth { constructor(communicator) { this.communicator = communicator; this.call = this.buildRequest({ call: constants_1.RPC_CALLS.eth_call, formatters: [null, inputFormatters.defaultBlockParam], }); this.getBalance = this.buildRequest({ call: constants_1.RPC_CALLS.eth_getBalance, formatters: [null, inputFormatters.defaultBlockParam], }); this.getCode = this.buildRequest({ call: constants_1.RPC_CALLS.eth_getCode, formatters: [null, inputFormatters.defaultBlockParam], }); this.getStorageAt = this.buildRequest({ call: constants_1.RPC_CALLS.eth_getStorageAt, formatters: [null, inputFormatters.blockNumberToHex, inputFormatters.defaultBlockParam], }); this.getPastLogs = this.buildRequest({ call: constants_1.RPC_CALLS.eth_getLogs, }); this.getBlockByHash = this.buildRequest({ call: constants_1.RPC_CALLS.eth_getBlockByHash, formatters: [null, inputFormatters.returnFullTxObjectParam], }); this.getBlockByNumber = this.buildRequest({ call: constants_1.RPC_CALLS.eth_getBlockByNumber, formatters: [inputFormatters.blockNumberToHex, inputFormatters.returnFullTxObjectParam], }); this.getTransactionByHash = this.buildRequest({ call: constants_1.RPC_CALLS.eth_getTransactionByHash, }); this.getTransactionReceipt = this.buildRequest({ call: constants_1.RPC_CALLS.eth_getTransactionReceipt, }); this.getTransactionCount = this.buildRequest({ call: constants_1.RPC_CALLS.eth_getTransactionCount, formatters: [null, inputFormatters.defaultBlockParam], }); this.getGasPrice = this.buildRequest({ call: constants_1.RPC_CALLS.eth_gasPrice, }); this.getEstimateGas = (transaction) => this.buildRequest({ call: constants_1.RPC_CALLS.eth_estimateGas, })([transaction]); } buildRequest(args) { const { call, formatters } = args; return async (params) => { if (formatters && Array.isArray(params)) { formatters.forEach((formatter, i) => { if (formatter) { params[i] = formatter(params[i]); } }); } const payload = { call, params: params || [], }; const response = await this.communicator.send(methods_1.Methods.rpcCall, payload); return response.data; }; } } exports.Eth = Eth; //# sourceMappingURL=index.js.map /***/ }), /***/ 85822: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getSDKVersion = void 0; const sdk_1 = __importDefault(__webpack_require__(15381)); exports["default"] = sdk_1.default; __exportStar(__webpack_require__(15381), exports); __exportStar(__webpack_require__(73302), exports); __exportStar(__webpack_require__(92628), exports); __exportStar(__webpack_require__(36750), exports); var utils_1 = __webpack_require__(56036); Object.defineProperty(exports, "getSDKVersion", ({ enumerable: true, get: function () { return utils_1.getSDKVersion; } })); //# sourceMappingURL=index.js.map /***/ }), /***/ 26016: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Safe = void 0; const ethers_1 = __webpack_require__(60374); const signatures_1 = __webpack_require__(73726); const methods_1 = __webpack_require__(92628); const constants_1 = __webpack_require__(71068); const requirePermissions_1 = __importDefault(__webpack_require__(2415)); class Safe { constructor(communicator) { this.communicator = communicator; } async getChainInfo() { const response = await this.communicator.send(methods_1.Methods.getChainInfo, undefined); return response.data; } async getInfo() { const response = await this.communicator.send(methods_1.Methods.getSafeInfo, undefined); return response.data; } // There is a possibility that this method will change because we may add pagination to the endpoint async experimental_getBalances({ currency = 'usd' } = {}) { const response = await this.communicator.send(methods_1.Methods.getSafeBalances, { currency, }); return response.data; } async check1271Signature(messageHash, signature = '0x') { const safeInfo = await this.getInfo(); const encodedIsValidSignatureCall = signatures_1.EIP_1271_INTERFACE.encodeFunctionData('isValidSignature', [ messageHash, signature, ]); const payload = { call: constants_1.RPC_CALLS.eth_call, params: [ { to: safeInfo.safeAddress, data: encodedIsValidSignatureCall, }, 'latest', ], }; try { const response = await this.communicator.send(methods_1.Methods.rpcCall, payload); return response.data.slice(0, 10).toLowerCase() === signatures_1.MAGIC_VALUE; } catch (err) { return false; } } async check1271SignatureBytes(messageHash, signature = '0x') { const safeInfo = await this.getInfo(); const msgBytes = ethers_1.ethers.utils.arrayify(messageHash); const encodedIsValidSignatureCall = signatures_1.EIP_1271_BYTES_INTERFACE.encodeFunctionData('isValidSignature', [ msgBytes, signature, ]); const payload = { call: constants_1.RPC_CALLS.eth_call, params: [ { to: safeInfo.safeAddress, data: encodedIsValidSignatureCall, }, 'latest', ], }; try { const response = await this.communicator.send(methods_1.Methods.rpcCall, payload); return response.data.slice(0, 10).toLowerCase() === signatures_1.MAGIC_VALUE_BYTES; } catch (err) { return false; } } calculateMessageHash(message) { return ethers_1.ethers.utils.hashMessage(message); } async isMessageSigned(message, signature = '0x') { const messageHash = this.calculateMessageHash(message); const messageHashSigned = await this.isMessageHashSigned(messageHash, signature); return messageHashSigned; } async isMessageHashSigned(messageHash, signature = '0x') { const checks = [this.check1271Signature.bind(this), this.check1271SignatureBytes.bind(this)]; for (const check of checks) { const isValid = await check(messageHash, signature); if (isValid) { return true; } } return false; } async getEnvironmentInfo() { const response = await this.communicator.send(methods_1.Methods.getEnvironmentInfo, undefined); return response.data; } async requestAddressBook() { const response = await this.communicator.send(methods_1.Methods.requestAddressBook, undefined); return response.data; } } __decorate([ (0, requirePermissions_1.default)() ], Safe.prototype, "requestAddressBook", null); exports.Safe = Safe; //# sourceMappingURL=index.js.map /***/ }), /***/ 73726: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.MAGIC_VALUE_BYTES = exports.MAGIC_VALUE = exports.EIP_1271_BYTES_INTERFACE = exports.EIP_1271_INTERFACE = void 0; const ethers_1 = __webpack_require__(60374); const MAGIC_VALUE = '0x1626ba7e'; exports.MAGIC_VALUE = MAGIC_VALUE; const MAGIC_VALUE_BYTES = '0x20c13b0b'; exports.MAGIC_VALUE_BYTES = MAGIC_VALUE_BYTES; const EIP_1271_INTERFACE = new ethers_1.ethers.utils.Interface([ 'function isValidSignature(bytes32 _dataHash, bytes calldata _signature) external view', ]); exports.EIP_1271_INTERFACE = EIP_1271_INTERFACE; const EIP_1271_BYTES_INTERFACE = new ethers_1.ethers.utils.Interface([ 'function isValidSignature(bytes calldata _data, bytes calldata _signature) public view', ]); exports.EIP_1271_BYTES_INTERFACE = EIP_1271_BYTES_INTERFACE; //# sourceMappingURL=signatures.js.map /***/ }), /***/ 15381: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); const communication_1 = __importDefault(__webpack_require__(55621)); const txs_1 = __webpack_require__(44931); const eth_1 = __webpack_require__(60770); const safe_1 = __webpack_require__(26016); const wallet_1 = __webpack_require__(55001); class SafeAppsSDK { constructor(opts = {}) { const { allowedDomains = null, debug = false } = opts; this.communicator = new communication_1.default(allowedDomains, debug); this.eth = new eth_1.Eth(this.communicator); this.txs = new txs_1.TXs(this.communicator); this.safe = new safe_1.Safe(this.communicator); this.wallet = new wallet_1.Wallet(this.communicator); } } exports["default"] = SafeAppsSDK; //# sourceMappingURL=sdk.js.map /***/ }), /***/ 44931: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.TXs = void 0; const methods_1 = __webpack_require__(92628); class TXs { constructor(communicator) { this.communicator = communicator; } async getBySafeTxHash(safeTxHash) { if (!safeTxHash) { throw new Error('Invalid safeTxHash'); } const response = await this.communicator.send(methods_1.Methods.getTxBySafeTxHash, { safeTxHash }); return response.data; } async signMessage(message) { const messagePayload = { message, }; const response = await this.communicator.send(methods_1.Methods.signMessage, messagePayload); return response.data; } async send({ txs, params }) { if (!txs || !txs.length) { throw new Error('No transactions were passed'); } const messagePayload = { txs, params, }; const response = await this.communicator.send(methods_1.Methods.sendTransactions, messagePayload); return response.data; } } exports.TXs = TXs; //# sourceMappingURL=index.js.map /***/ }), /***/ 23672: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.TransferDirection = exports.TransactionStatus = exports.TokenType = exports.Operation = void 0; var safe_react_gateway_sdk_1 = __webpack_require__(97663); Object.defineProperty(exports, "Operation", ({ enumerable: true, get: function () { return safe_react_gateway_sdk_1.Operation; } })); Object.defineProperty(exports, "TokenType", ({ enumerable: true, get: function () { return safe_react_gateway_sdk_1.TokenType; } })); Object.defineProperty(exports, "TransactionStatus", ({ enumerable: true, get: function () { return safe_react_gateway_sdk_1.TransactionStatus; } })); Object.defineProperty(exports, "TransferDirection", ({ enumerable: true, get: function () { return safe_react_gateway_sdk_1.TransferDirection; } })); //# sourceMappingURL=gateway.js.map /***/ }), /***/ 73302: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", ({ value: true })); __exportStar(__webpack_require__(24644), exports); __exportStar(__webpack_require__(49741), exports); __exportStar(__webpack_require__(23672), exports); __exportStar(__webpack_require__(52350), exports); //# sourceMappingURL=index.js.map /***/ }), /***/ 52350: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const methods_1 = __webpack_require__(92628); //# sourceMappingURL=messaging.js.map /***/ }), /***/ 95238: /***/ (function(__unused_webpack_module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.PermissionsError = exports.PERMISSIONS_REQUEST_REJECTED = void 0; exports.PERMISSIONS_REQUEST_REJECTED = 4001; class PermissionsError extends Error { constructor(message, code, data) { super(message); this.code = code; this.data = data; // Should adjust prototype manually because how TS handles the type extension compilation // https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work Object.setPrototypeOf(this, PermissionsError.prototype); } } exports.PermissionsError = PermissionsError; //# sourceMappingURL=permissions.js.map /***/ }), /***/ 49741: /***/ (function(__unused_webpack_module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); //# sourceMappingURL=rpc.js.map /***/ }), /***/ 24644: /***/ (function(__unused_webpack_module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); //# sourceMappingURL=sdk.js.map /***/ }), /***/ 56036: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getSDKVersion = void 0; const package_json_1 = __importDefault(__webpack_require__(72010)); // Slice is needed for versions like '1.0.0-beta.0' const getSDKVersion = () => package_json_1.default.version.slice(0, 5); exports.getSDKVersion = getSDKVersion; //# sourceMappingURL=utils.js.map /***/ }), /***/ 55001: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Wallet = void 0; const methods_1 = __webpack_require__(92628); const permissions_1 = __webpack_require__(95238); class Wallet { constructor(communicator) { this.communicator = communicator; } async getPermissions() { const response = await this.communicator.send(methods_1.Methods.wallet_getPermissions, undefined); return response.data; } async requestPermissions(permissions) { if (!this.isPermissionRequestValid(permissions)) { throw new permissions_1.PermissionsError('Permissions request is invalid', permissions_1.PERMISSIONS_REQUEST_REJECTED); } try { const response = await this.communicator.send(methods_1.Methods.wallet_requestPermissions, permissions); return response.data; } catch (_a) { throw new permissions_1.PermissionsError('Permissions rejected', permissions_1.PERMISSIONS_REQUEST_REJECTED); } } isPermissionRequestValid(permissions) { return permissions.every((pr) => { if (typeof pr === 'object') { return Object.keys(pr).every((method) => { if (Object.values(methods_1.RestrictedMethods).includes(method)) { return true; } return false; }); } return false; }); } } exports.Wallet = Wallet; //# sourceMappingURL=index.js.map /***/ }), /***/ 48912: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; }; var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; var _SafeConnector_instances, _SafeConnector_provider, _SafeConnector_sdk, _SafeConnector_safe, _SafeConnector_getSafeInfo, _SafeConnector_isSafeApp; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.SafeConnector = void 0; const providers_1 = __webpack_require__(88901); const safe_apps_provider_1 = __webpack_require__(96844); const safe_apps_sdk_1 = __importDefault(__webpack_require__(85822)); const utils_1 = __webpack_require__(56371); const core_1 = __webpack_require__(1534); function normalizeChainId(chainId) { if (typeof chainId === 'string') { const isHex = chainId.trim().substring(0, 2); return Number.parseInt(chainId, isHex === '0x' ? 16 : 10); } return chainId; } const __IS_SERVER__ = typeof window === 'undefined'; const __IS_IFRAME__ = !__IS_SERVER__ && (window === null || window === void 0 ? void 0 : window.parent) !== window; class SafeConnector extends core_1.Connector { constructor(config) { super(Object.assign(Object.assign({}, config), { options: config === null || config === void 0 ? void 0 : config.options })); _SafeConnector_instances.add(this); this.id = 'safe'; this.name = 'Safe'; this.ready = !__IS_SERVER__ && __IS_IFRAME__; _SafeConnector_provider.set(this, void 0); _SafeConnector_sdk.set(this, void 0); _SafeConnector_safe.set(this, void 0); __classPrivateFieldSet(this, _SafeConnector_sdk, new safe_apps_sdk_1.default(config.options), "f"); } async connect() { const runningAsSafeApp = await __classPrivateFieldGet(this, _SafeConnector_instances, "m", _SafeConnector_isSafeApp).call(this); if (!runningAsSafeApp) { throw new core_1.ConnectorNotFoundError(); } const provider = await this.getProvider(); if (provider.on) { provider.on('accountsChanged', this.onAccountsChanged); provider.on('chainChanged', this.onChainChanged); provider.on('disconnect', this.onDisconnect); } const account = await this.getAccount(); const id = await this.getChainId(); return { account, provider, chain: { id, unsupported: await this.isChainUnsupported(id) }, }; } async disconnect() { const provider = await this.getProvider(); if (!(provider === null || provider === void 0 ? void 0 : provider.removeListener)) return; provider.removeListener('accountsChanged', this.onAccountsChanged); provider.removeListener('chainChanged', this.onChainChanged); provider.removeListener('disconnect', this.onDisconnect); } async getAccount() { if (!__classPrivateFieldGet(this, _SafeConnector_safe, "f")) { throw new core_1.ConnectorNotFoundError(); } return (0, utils_1.getAddress)(__classPrivateFieldGet(this, _SafeConnector_safe, "f").safeAddress); } async getChainId() { if (!__classPrivateFieldGet(this, _SafeConnector_provider, "f")) { throw new core_1.ConnectorNotFoundError(); } return normalizeChainId(__classPrivateFieldGet(this, _SafeConnector_provider, "f").chainId); } async getProvider() { if (!__classPrivateFieldGet(this, _SafeConnector_provider, "f")) { const safe = await __classPrivateFieldGet(this, _SafeConnector_instances, "m", _SafeConnector_getSafeInfo).call(this); if (!safe) { throw new Error('Could not load Safe information'); } __classPrivateFieldSet(this, _SafeConnector_provider, new safe_apps_provider_1.SafeAppProvider(safe, __classPrivateFieldGet(this, _SafeConnector_sdk, "f")), "f"); } return __classPrivateFieldGet(this, _SafeConnector_provider, "f"); } async getSigner() { const provider = await this.getProvider(); const account = await this.getAccount(); return new providers_1.Web3Provider(provider).getSigner(account); } async isAuthorized() { try { const account = await this.getAccount(); return !!account; } catch (_a) { return false; } } onAccountsChanged(accounts) { if (accounts.length === 0) this.emit('disconnect'); else this.emit('change', { account: (0, utils_1.getAddress)(accounts[0]) }); } isChainUnsupported(chainId) { return !this.chains.some((x) => x.id === chainId); } onChainChanged(chainId) { const id = normalizeChainId(chainId); const unsupported = this.isChainUnsupported(id); this.emit('change', { chain: { id, unsupported } }); } onDisconnect() { this.emit('disconnect'); } } exports.SafeConnector = SafeConnector; _SafeConnector_provider = new WeakMap(), _SafeConnector_sdk = new WeakMap(), _SafeConnector_safe = new WeakMap(), _SafeConnector_instances = new WeakSet(), _SafeConnector_getSafeInfo = async function _SafeConnector_getSafeInfo() { if (!__classPrivateFieldGet(this, _SafeConnector_sdk, "f")) { throw new core_1.ConnectorNotFoundError(); } if (!__classPrivateFieldGet(this, _SafeConnector_safe, "f")) { __classPrivateFieldSet(this, _SafeConnector_safe, await __classPrivateFieldGet(this, _SafeConnector_sdk, "f").safe.getInfo(), "f"); } return __classPrivateFieldGet(this, _SafeConnector_safe, "f"); }, _SafeConnector_isSafeApp = async function _SafeConnector_isSafeApp() { if (!this.ready) { return false; } const safe = await Promise.race([__classPrivateFieldGet(this, _SafeConnector_instances, "m", _SafeConnector_getSafeInfo).call(this), new Promise((resolve) => setTimeout(resolve, 300))]); return !!safe; }; //# sourceMappingURL=index.js.map /***/ }), /***/ 97663: /***/ (function(module) { !function(t,e){ true?module.exports=e():0}(this,(function(){return(()=>{var t={98:function(t,e){var n="undefined"!=typeof self?self:this,r=function(){function t(){this.fetch=!1,this.DOMException=n.DOMException}return t.prototype=n,new t}();!function(t){!function(e){var n="URLSearchParams"in t,r="Symbol"in t&&"iterator"in Symbol,o="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),i="FormData"in t,s="ArrayBuffer"in t;if(s)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(t){return t&&a.indexOf(Object.prototype.toString.call(t))>-1};function u(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function d(t){return"string"!=typeof t&&(t=String(t)),t}function f(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return r&&(e[Symbol.iterator]=function(){return e}),e}function h(t){this.map={},t instanceof h?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function p(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function l(t){return new Promise((function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}}))}function y(t){var e=new FileReader,n=l(e);return e.readAsArrayBuffer(t),n}function E(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:o&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:i&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:n&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&o&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=E(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||c(t))?this._bodyArrayBuffer=E(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var t=p(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?p(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var t,e,n,r=p(this);if(r)return r;if(this._bodyBlob)return t=this._bodyBlob,n=l(e=new FileReader),e.readAsText(t),n;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),n=new Array(e.length),r=0;r-1?r:n),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function I(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var n=t.split("="),r=n.shift().replace(/\+/g," "),o=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(r),decodeURIComponent(o))}})),e}function O(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new h(e.headers),this.url=e.url||"",this._initBody(t)}T.prototype.clone=function(){return new T(this,{body:this._bodyInit})},b.call(T.prototype),b.call(O.prototype),O.prototype.clone=function(){return new O(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},O.error=function(){var t=new O(null,{status:0,statusText:""});return t.type="error",t};var _=[301,302,303,307,308];O.redirect=function(t,e){if(-1===_.indexOf(e))throw new RangeError("Invalid status code");return new O(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var n=Error(t);this.stack=n.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function v(t,n){return new Promise((function(r,i){var s=new T(t,n);if(s.signal&&s.signal.aborted)return i(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var t,e,n={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new h,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var n=t.split(":"),r=n.shift().trim();if(r){var o=n.join(":").trim();e.append(r,o)}})),e)};n.url="responseURL"in a?a.responseURL:n.headers.get("X-Request-URL");var o="response"in a?a.response:a.responseText;r(new O(o,n))},a.onerror=function(){i(new TypeError("Network request failed"))},a.ontimeout=function(){i(new TypeError("Network request failed"))},a.onabort=function(){i(new e.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&o&&(a.responseType="blob"),s.headers.forEach((function(t,e){a.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",c),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",c)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}v.polyfill=!0,t.fetch||(t.fetch=v,t.Headers=h,t.Request=T,t.Response=O),e.Headers=h,e.Request=T,e.Response=O,e.fetch=v,Object.defineProperty(e,"__esModule",{value:!0})}({})}(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var o=r;(e=o.fetch).default=o.fetch,e.fetch=o.fetch,e.Headers=o.Headers,e.Request=o.Request,e.Response=o.Response,t.exports=e}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var i=e[r]={exports:{}};return t[r].call(i.exports,i,i.exports,n),i.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};return(()=>{"use strict";n.r(r),n.d(r,{FEATURES:()=>h,GAS_PRICE_TYPE:()=>f,ImplementationVersionState:()=>t,LabelValue:()=>u,Operation:()=>o,RPC_AUTHENTICATION:()=>d,SafeAppAccessPolicyTypes:()=>e,SettingsInfoType:()=>c,TokenType:()=>p,TransactionStatus:()=>i,TransactionTokenType:()=>a,TransferDirection:()=>s,getBalances:()=>N,getChainConfig:()=>x,getChainsConfig:()=>U,getCollectibles:()=>w,getCollectiblesPage:()=>S,getDecodedData:()=>G,getFiatCurrencies:()=>m,getIncomingTransfers:()=>O,getMasterCopies:()=>M,getModuleTransactions:()=>_,getMultisigTransactions:()=>v,getOwnedSafes:()=>g,getSafeApps:()=>B,getSafeInfo:()=>I,getTransactionDetails:()=>R,getTransactionHistory:()=>D,getTransactionQueue:()=>C,postSafeGasEstimation:()=>L,proposeTransaction:()=>P,setBaseUrl:()=>T});var t,e,o,i,s,a,c,u,d,f,h,p,l=n(98),y=n.n(l);function E(t,e){return n=this,r=void 0,i=function(){var n,r,o,i,s;return function(t,e){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]1?r-1:0),e=1;e3?r.i-4:r.i:Array.isArray(n)?1:s(n)?2:v(n)?3:0}function u(n,r){return 2===o(n)?n.has(r):Object.prototype.hasOwnProperty.call(n,r)}function a(n,r){return 2===o(n)?n.get(r):n[r]}function f(n,r,t){var e=o(n);2===e?n.set(r,t):3===e?(n.delete(r),n.add(t)):n[r]=t}function c(n,r){return n===r?0!==n||1/n==1/r:n!=n&&r!=r}function s(n){return X&&n instanceof Map}function v(n){return q&&n instanceof Set}function p(n){return n.o||n.t}function l(n){if(Array.isArray(n))return Array.prototype.slice.call(n);var r=rn(n);delete r[Q];for(var t=nn(r),e=0;e1&&(n.set=n.add=n.clear=n.delete=h),Object.freeze(n),e&&i(n,(function(n,r){return d(r,!0)}),!0),n)}function h(){n(2)}function y(n){return null==n||"object"!=typeof n||Object.isFrozen(n)}function b(r){var t=tn[r];return t||n(18,r),t}function m(n,r){tn[n]||(tn[n]=r)}function _(){return true||0,U}function j(n,r){r&&(b("Patches"),n.u=[],n.s=[],n.v=r)}function O(n){g(n),n.p.forEach(S),n.p=null}function g(n){n===U&&(U=n.l)}function w(n){return U={p:[],l:U,h:n,m:!0,_:0}}function S(n){var r=n[Q];0===r.i||1===r.i?r.j():r.O=!0}function P(r,e){e._=e.p.length;var i=e.p[0],o=void 0!==r&&r!==i;return e.h.g||b("ES5").S(e,r,o),o?(i[Q].P&&(O(e),n(4)),t(r)&&(r=M(e,r),e.l||x(e,r)),e.u&&b("Patches").M(i[Q].t,r,e.u,e.s)):r=M(e,i,[]),O(e),e.u&&e.v(e.u,e.s),r!==H?r:void 0}function M(n,r,t){if(y(r))return r;var e=r[Q];if(!e)return i(r,(function(i,o){return A(n,e,r,i,o,t)}),!0),r;if(e.A!==n)return r;if(!e.P)return x(n,e.t,!0),e.t;if(!e.I){e.I=!0,e.A._--;var o=4===e.i||5===e.i?e.o=l(e.k):e.o;i(3===e.i?new Set(o):o,(function(r,i){return A(n,e,o,r,i,t)})),x(n,o,!1),t&&n.u&&b("Patches").R(e,t,n.u,n.s)}return e.o}function A(e,i,o,a,c,s){if( false&&0,r(c)){var v=M(e,c,s&&i&&3!==i.i&&!u(i.D,a)?s.concat(a):void 0);if(f(o,a,v),!r(v))return;e.m=!1}if(t(c)&&!y(c)){if(!e.h.F&&e._<1)return;M(e,c),i&&i.A.l||x(e,c)}}function x(n,r,t){void 0===t&&(t=!1),n.h.F&&n.m&&d(r,t)}function z(n,r){var t=n[Q];return(t?p(t):n)[r]}function I(n,r){if(r in n)for(var t=Object.getPrototypeOf(n);t;){var e=Object.getOwnPropertyDescriptor(t,r);if(e)return e;t=Object.getPrototypeOf(t)}}function k(n){n.P||(n.P=!0,n.l&&k(n.l))}function E(n){n.o||(n.o=l(n.t))}function R(n,r,t){var e=s(r)?b("MapSet").N(r,t):v(r)?b("MapSet").T(r,t):n.g?function(n,r){var t=Array.isArray(n),e={i:t?1:0,A:r?r.A:_(),P:!1,I:!1,D:{},l:r,t:n,k:null,o:null,j:null,C:!1},i=e,o=en;t&&(i=[e],o=on);var u=Proxy.revocable(i,o),a=u.revoke,f=u.proxy;return e.k=f,e.j=a,f}(r,t):b("ES5").J(r,t);return(t?t.A:_()).p.push(e),e}function D(e){return r(e)||n(22,e),function n(r){if(!t(r))return r;var e,u=r[Q],c=o(r);if(u){if(!u.P&&(u.i<4||!b("ES5").K(u)))return u.t;u.I=!0,e=F(r,c),u.I=!1}else e=F(r,c);return i(e,(function(r,t){u&&a(u.t,r)===t||f(e,r,n(t))})),3===c?new Set(e):e}(e)}function F(n,r){switch(r){case 2:return new Map(n);case 3:return Array.from(n)}return l(n)}function N(){function t(n,r){var t=s[n];return t?t.enumerable=r:s[n]=t={configurable:!0,enumerable:r,get:function(){var r=this[Q];return false&&0,en.get(r,n)},set:function(r){var t=this[Q]; false&&0,en.set(t,n,r)}},t}function e(n){for(var r=n.length-1;r>=0;r--){var t=n[r][Q];if(!t.P)switch(t.i){case 5:a(t)&&k(t);break;case 4:o(t)&&k(t)}}}function o(n){for(var r=n.t,t=n.k,e=nn(t),i=e.length-1;i>=0;i--){var o=e[i];if(o!==Q){var a=r[o];if(void 0===a&&!u(r,o))return!0;var f=t[o],s=f&&f[Q];if(s?s.t!==a:!c(f,a))return!0}}var v=!!r[Q];return e.length!==nn(r).length+(v?0:1)}function a(n){var r=n.k;if(r.length!==n.t.length)return!0;var t=Object.getOwnPropertyDescriptor(r,r.length-1);if(t&&!t.get)return!0;for(var e=0;e1?t-1:0),o=1;o1?t-1:0),o=1;o=0;e--){var i=t[e];if(0===i.path.length&&"replace"===i.op){n=i.value;break}}e>-1&&(t=t.slice(e+1));var o=b("Patches").$;return r(n)?o(n,t):this.produce(n,(function(n){return o(n,t)}))},e}(),an=new un,fn=an.produce,cn=an.produceWithPatches.bind(an),sn=an.setAutoFreeze.bind(an),vn=an.setUseProxies.bind(an),pn=an.applyPatches.bind(an),ln=an.createDraft.bind(an),dn=an.finishDraft.bind(an);/* harmony default export */ var immer_esm = (fn); //# sourceMappingURL=immer.esm.js.map // EXTERNAL MODULE: ./node_modules/redux/es/redux.js + 2 modules var redux = __webpack_require__(89569); ;// CONCATENATED MODULE: ./node_modules/redux-thunk/es/index.js /** A function that accepts a potential "extra argument" value to be injected later, * and returns an instance of the thunk middleware that uses that value */ function createThunkMiddleware(extraArgument) { // Standard Redux middleware definition pattern: // See: https://redux.js.org/tutorials/fundamentals/part-4-store#writing-custom-middleware var middleware = function middleware(_ref) { var dispatch = _ref.dispatch, getState = _ref.getState; return function (next) { return function (action) { // The thunk middleware looks for any functions that were passed to `store.dispatch`. // If this "action" is really a function, call it and return the result. if (typeof action === 'function') { // Inject the store's `dispatch` and `getState` methods, as well as any "extra arg" return action(dispatch, getState, extraArgument); } // Otherwise, pass the action down the middleware chain as usual return next(action); }; }; }; return middleware; } var thunk = createThunkMiddleware(); // Attach the factory function so users can create a customized version // with whatever "extra arg" they want to inject into their thunks thunk.withExtraArgument = createThunkMiddleware; /* harmony default export */ var es = (thunk); ;// CONCATENATED MODULE: ./node_modules/@reduxjs/toolkit/dist/redux-toolkit.esm.js var __extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __generator = (undefined && undefined.__generator) || function (thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from) { for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) to[j] = from[i]; return to; }; var __defProp = Object.defineProperty; var __defProps = Object.defineProperties; var __getOwnPropDescs = Object.getOwnPropertyDescriptors; var __getOwnPropSymbols = Object.getOwnPropertySymbols; var __hasOwnProp = Object.prototype.hasOwnProperty; var __propIsEnum = Object.prototype.propertyIsEnumerable; var __defNormalProp = function (obj, key, value) { return key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value: value }) : obj[key] = value; }; var __spreadValues = function (a, b) { for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]); if (__getOwnPropSymbols) for (var _i = 0, _c = __getOwnPropSymbols(b); _i < _c.length; _i++) { var prop = _c[_i]; if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]); } return a; }; var __spreadProps = function (a, b) { return __defProps(a, __getOwnPropDescs(b)); }; var __async = function (__this, __arguments, generator) { return new Promise(function (resolve, reject) { var fulfilled = function (value) { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = function (value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = function (x) { return x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); }; step((generator = generator.apply(__this, __arguments)).next()); }); }; // src/index.ts // src/createDraftSafeSelector.ts var createDraftSafeSelector = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } var selector = createSelector.apply(void 0, args); var wrappedSelector = function (value) { var rest = []; for (var _i = 1; _i < arguments.length; _i++) { rest[_i - 1] = arguments[_i]; } return selector.apply(void 0, __spreadArray([isDraft(value) ? current(value) : value], rest)); }; return wrappedSelector; }; // src/configureStore.ts // src/devtoolsExtension.ts var composeWithDevTools = typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : function () { if (arguments.length === 0) return void 0; if (typeof arguments[0] === "object") return redux/* compose */.qC; return redux/* compose.apply */.qC.apply(null, arguments); }; var devToolsEnhancer = typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION__ ? window.__REDUX_DEVTOOLS_EXTENSION__ : function () { return function (noop2) { return noop2; }; }; // src/isPlainObject.ts function isPlainObject(value) { if (typeof value !== "object" || value === null) return false; var proto = Object.getPrototypeOf(value); if (proto === null) return true; var baseProto = proto; while (Object.getPrototypeOf(baseProto) !== null) { baseProto = Object.getPrototypeOf(baseProto); } return proto === baseProto; } // src/getDefaultMiddleware.ts // src/utils.ts function getTimeMeasureUtils(maxDelay, fnName) { var elapsed = 0; return { measureTime: function (fn) { var started = Date.now(); try { return fn(); } finally { var finished = Date.now(); elapsed += finished - started; } }, warnIfExceeded: function () { if (elapsed > maxDelay) { console.warn(fnName + " took " + elapsed + "ms, which is more than the warning threshold of " + maxDelay + "ms. \nIf your state or actions are very large, you may want to disable the middleware as it might cause too much of a slowdown in development mode. See https://redux-toolkit.js.org/api/getDefaultMiddleware for instructions.\nIt is disabled in production builds, so you don't need to worry about that."); } } }; } var MiddlewareArray = /** @class */ (function (_super) { __extends(MiddlewareArray, _super); function MiddlewareArray() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } var _this = _super.apply(this, args) || this; Object.setPrototypeOf(_this, MiddlewareArray.prototype); return _this; } Object.defineProperty(MiddlewareArray, Symbol.species, { get: function () { return MiddlewareArray; }, enumerable: false, configurable: true }); MiddlewareArray.prototype.concat = function () { var arr = []; for (var _i = 0; _i < arguments.length; _i++) { arr[_i] = arguments[_i]; } return _super.prototype.concat.apply(this, arr); }; MiddlewareArray.prototype.prepend = function () { var arr = []; for (var _i = 0; _i < arguments.length; _i++) { arr[_i] = arguments[_i]; } if (arr.length === 1 && Array.isArray(arr[0])) { return new (MiddlewareArray.bind.apply(MiddlewareArray, __spreadArray([void 0], arr[0].concat(this))))(); } return new (MiddlewareArray.bind.apply(MiddlewareArray, __spreadArray([void 0], arr.concat(this))))(); }; return MiddlewareArray; }(Array)); // src/immutableStateInvariantMiddleware.ts var isProduction = (/* unused pure expression or super */ null && ("production" === "production")); var prefix = "Invariant failed"; function invariant(condition, message) { if (condition) { return; } if (isProduction) { throw new Error(prefix); } throw new Error(prefix + ": " + (message || "")); } function stringify(obj, serializer, indent, decycler) { return JSON.stringify(obj, getSerialize(serializer, decycler), indent); } function getSerialize(serializer, decycler) { var stack = [], keys = []; if (!decycler) decycler = function (_, value) { if (stack[0] === value) return "[Circular ~]"; return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]"; }; return function (key, value) { if (stack.length > 0) { var thisPos = stack.indexOf(this); ~thisPos ? stack.splice(thisPos + 1) : stack.push(this); ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key); if (~stack.indexOf(value)) value = decycler.call(this, key, value); } else stack.push(value); return serializer == null ? value : serializer.call(this, key, value); }; } function isImmutableDefault(value) { return typeof value !== "object" || value === null || typeof value === "undefined" || Object.isFrozen(value); } function trackForMutations(isImmutable, ignorePaths, obj) { var trackedProperties = trackProperties(isImmutable, ignorePaths, obj); return { detectMutations: function () { return detectMutations(isImmutable, ignorePaths, trackedProperties, obj); } }; } function trackProperties(isImmutable, ignorePaths, obj, path) { if (ignorePaths === void 0) { ignorePaths = []; } if (path === void 0) { path = ""; } var tracked = { value: obj }; if (!isImmutable(obj)) { tracked.children = {}; for (var key in obj) { var childPath = path ? path + "." + key : key; if (ignorePaths.length && ignorePaths.indexOf(childPath) !== -1) { continue; } tracked.children[key] = trackProperties(isImmutable, ignorePaths, obj[key], childPath); } } return tracked; } function detectMutations(isImmutable, ignorePaths, trackedProperty, obj, sameParentRef, path) { if (ignorePaths === void 0) { ignorePaths = []; } if (sameParentRef === void 0) { sameParentRef = false; } if (path === void 0) { path = ""; } var prevObj = trackedProperty ? trackedProperty.value : void 0; var sameRef = prevObj === obj; if (sameParentRef && !sameRef && !Number.isNaN(obj)) { return { wasMutated: true, path: path }; } if (isImmutable(prevObj) || isImmutable(obj)) { return { wasMutated: false }; } var keysToDetect = {}; for (var key in trackedProperty.children) { keysToDetect[key] = true; } for (var key in obj) { keysToDetect[key] = true; } for (var key in keysToDetect) { var childPath = path ? path + "." + key : key; if (ignorePaths.length && ignorePaths.indexOf(childPath) !== -1) { continue; } var result = detectMutations(isImmutable, ignorePaths, trackedProperty.children[key], obj[key], sameRef, childPath); if (result.wasMutated) { return result; } } return { wasMutated: false }; } function createImmutableStateInvariantMiddleware(options) { if (options === void 0) { options = {}; } if (true) { return function () { return function (next) { return function (action) { return next(action); }; }; }; } var _c = options.isImmutable, isImmutable = _c === void 0 ? isImmutableDefault : _c, ignoredPaths = options.ignoredPaths, _d = options.warnAfter, warnAfter = _d === void 0 ? 32 : _d, ignore = options.ignore; ignoredPaths = ignoredPaths || ignore; var track = trackForMutations.bind(null, isImmutable, ignoredPaths); return function (_c) { var getState = _c.getState; var state = getState(); var tracker = track(state); var result; return function (next) { return function (action) { var measureUtils = getTimeMeasureUtils(warnAfter, "ImmutableStateInvariantMiddleware"); measureUtils.measureTime(function () { state = getState(); result = tracker.detectMutations(); tracker = track(state); invariant(!result.wasMutated, "A state mutation was detected between dispatches, in the path '" + (result.path || "") + "'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)"); }); var dispatchedAction = next(action); measureUtils.measureTime(function () { state = getState(); result = tracker.detectMutations(); tracker = track(state); result.wasMutated && invariant(!result.wasMutated, "A state mutation was detected inside a dispatch, in the path: " + (result.path || "") + ". Take a look at the reducer(s) handling the action " + stringify(action) + ". (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)"); }); measureUtils.warnIfExceeded(); return dispatchedAction; }; }; }; } // src/serializableStateInvariantMiddleware.ts function isPlain(val) { var type = typeof val; return type === "undefined" || val === null || type === "string" || type === "boolean" || type === "number" || Array.isArray(val) || isPlainObject(val); } function findNonSerializableValue(value, path, isSerializable, getEntries, ignoredPaths) { if (path === void 0) { path = ""; } if (isSerializable === void 0) { isSerializable = isPlain; } if (ignoredPaths === void 0) { ignoredPaths = []; } var foundNestedSerializable; if (!isSerializable(value)) { return { keyPath: path || "", value: value }; } if (typeof value !== "object" || value === null) { return false; } var entries = getEntries != null ? getEntries(value) : Object.entries(value); var hasIgnoredPaths = ignoredPaths.length > 0; for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) { var _c = entries_1[_i], key = _c[0], nestedValue = _c[1]; var nestedPath = path ? path + "." + key : key; if (hasIgnoredPaths && ignoredPaths.indexOf(nestedPath) >= 0) { continue; } if (!isSerializable(nestedValue)) { return { keyPath: nestedPath, value: nestedValue }; } if (typeof nestedValue === "object") { foundNestedSerializable = findNonSerializableValue(nestedValue, nestedPath, isSerializable, getEntries, ignoredPaths); if (foundNestedSerializable) { return foundNestedSerializable; } } } return false; } function createSerializableStateInvariantMiddleware(options) { if (options === void 0) { options = {}; } if (true) { return function () { return function (next) { return function (action) { return next(action); }; }; }; } var _c = options.isSerializable, isSerializable = _c === void 0 ? isPlain : _c, getEntries = options.getEntries, _d = options.ignoredActions, ignoredActions = _d === void 0 ? [] : _d, _e = options.ignoredActionPaths, ignoredActionPaths = _e === void 0 ? ["meta.arg", "meta.baseQueryMeta"] : _e, _f = options.ignoredPaths, ignoredPaths = _f === void 0 ? [] : _f, _g = options.warnAfter, warnAfter = _g === void 0 ? 32 : _g, _h = options.ignoreState, ignoreState = _h === void 0 ? false : _h, _j = options.ignoreActions, ignoreActions = _j === void 0 ? false : _j; return function (storeAPI) { return function (next) { return function (action) { var result = next(action); var measureUtils = getTimeMeasureUtils(warnAfter, "SerializableStateInvariantMiddleware"); if (!ignoreActions && !(ignoredActions.length && ignoredActions.indexOf(action.type) !== -1)) { measureUtils.measureTime(function () { var foundActionNonSerializableValue = findNonSerializableValue(action, "", isSerializable, getEntries, ignoredActionPaths); if (foundActionNonSerializableValue) { var keyPath = foundActionNonSerializableValue.keyPath, value = foundActionNonSerializableValue.value; console.error("A non-serializable value was detected in an action, in the path: `" + keyPath + "`. Value:", value, "\nTake a look at the logic that dispatched this action: ", action, "\n(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)", "\n(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)"); } }); } if (!ignoreState) { measureUtils.measureTime(function () { var state = storeAPI.getState(); var foundStateNonSerializableValue = findNonSerializableValue(state, "", isSerializable, getEntries, ignoredPaths); if (foundStateNonSerializableValue) { var keyPath = foundStateNonSerializableValue.keyPath, value = foundStateNonSerializableValue.value; console.error("A non-serializable value was detected in the state, in the path: `" + keyPath + "`. Value:", value, "\nTake a look at the reducer(s) handling this action type: " + action.type + ".\n(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)"); } }); measureUtils.warnIfExceeded(); } return result; }; }; }; } // src/getDefaultMiddleware.ts function isBoolean(x) { return typeof x === "boolean"; } function curryGetDefaultMiddleware() { return function curriedGetDefaultMiddleware(options) { return getDefaultMiddleware(options); }; } function getDefaultMiddleware(options) { if (options === void 0) { options = {}; } var _c = options.thunk, thunk = _c === void 0 ? true : _c, _d = options.immutableCheck, immutableCheck = _d === void 0 ? true : _d, _e = options.serializableCheck, serializableCheck = _e === void 0 ? true : _e; var middlewareArray = new MiddlewareArray(); if (thunk) { if (isBoolean(thunk)) { middlewareArray.push(es); } else { middlewareArray.push(es.withExtraArgument(thunk.extraArgument)); } } if (false) { var serializableOptions, immutableOptions; } return middlewareArray; } // src/configureStore.ts var IS_PRODUCTION = "production" === "production"; function configureStore(options) { var curriedGetDefaultMiddleware = curryGetDefaultMiddleware(); var _c = options || {}, _d = _c.reducer, reducer = _d === void 0 ? void 0 : _d, _e = _c.middleware, middleware = _e === void 0 ? curriedGetDefaultMiddleware() : _e, _f = _c.devTools, devTools = _f === void 0 ? true : _f, _g = _c.preloadedState, preloadedState = _g === void 0 ? void 0 : _g, _h = _c.enhancers, enhancers = _h === void 0 ? void 0 : _h; var rootReducer; if (typeof reducer === "function") { rootReducer = reducer; } else if (isPlainObject(reducer)) { rootReducer = (0,redux/* combineReducers */.UY)(reducer); } else { throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers'); } var finalMiddleware = middleware; if (typeof finalMiddleware === "function") { finalMiddleware = finalMiddleware(curriedGetDefaultMiddleware); if (!IS_PRODUCTION && !Array.isArray(finalMiddleware)) { throw new Error("when using a middleware builder function, an array of middleware must be returned"); } } if (!IS_PRODUCTION && finalMiddleware.some(function (item) { return typeof item !== "function"; })) { throw new Error("each middleware provided to configureStore must be a function"); } var middlewareEnhancer = redux/* applyMiddleware.apply */.md.apply(void 0, finalMiddleware); var finalCompose = redux/* compose */.qC; if (devTools) { finalCompose = composeWithDevTools(__spreadValues({ trace: !IS_PRODUCTION }, typeof devTools === "object" && devTools)); } var storeEnhancers = [middlewareEnhancer]; if (Array.isArray(enhancers)) { storeEnhancers = __spreadArray([middlewareEnhancer], enhancers); } else if (typeof enhancers === "function") { storeEnhancers = enhancers(storeEnhancers); } var composedEnhancer = finalCompose.apply(void 0, storeEnhancers); return (0,redux/* createStore */.MT)(rootReducer, preloadedState, composedEnhancer); } // src/createAction.ts function createAction(type, prepareAction) { function actionCreator() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } if (prepareAction) { var prepared = prepareAction.apply(void 0, args); if (!prepared) { throw new Error("prepareAction did not return an object"); } return __spreadValues(__spreadValues({ type: type, payload: prepared.payload }, "meta" in prepared && { meta: prepared.meta }), "error" in prepared && { error: prepared.error }); } return { type: type, payload: args[0] }; } actionCreator.toString = function () { return "" + type; }; actionCreator.type = type; actionCreator.match = function (action) { return action.type === type; }; return actionCreator; } function isFSA(action) { return isPlainObject(action) && typeof action.type === "string" && Object.keys(action).every(isValidKey); } function isValidKey(key) { return ["type", "payload", "error", "meta"].indexOf(key) > -1; } function getType(actionCreator) { return "" + actionCreator; } // src/createReducer.ts // src/mapBuilders.ts function executeReducerBuilderCallback(builderCallback) { var actionsMap = {}; var actionMatchers = []; var defaultCaseReducer; var builder = { addCase: function (typeOrActionCreator, reducer) { if (false) {} var type = typeof typeOrActionCreator === "string" ? typeOrActionCreator : typeOrActionCreator.type; if (type in actionsMap) { throw new Error("addCase cannot be called with two reducers for the same action type"); } actionsMap[type] = reducer; return builder; }, addMatcher: function (matcher, reducer) { if (false) {} actionMatchers.push({ matcher: matcher, reducer: reducer }); return builder; }, addDefaultCase: function (reducer) { if (false) {} defaultCaseReducer = reducer; return builder; } }; builderCallback(builder); return [actionsMap, actionMatchers, defaultCaseReducer]; } // src/createReducer.ts function isStateFunction(x) { return typeof x === "function"; } function createReducer(initialState, mapOrBuilderCallback, actionMatchers, defaultCaseReducer) { if (actionMatchers === void 0) { actionMatchers = []; } var _c = typeof mapOrBuilderCallback === "function" ? executeReducerBuilderCallback(mapOrBuilderCallback) : [mapOrBuilderCallback, actionMatchers, defaultCaseReducer], actionsMap = _c[0], finalActionMatchers = _c[1], finalDefaultCaseReducer = _c[2]; var getInitialState; if (isStateFunction(initialState)) { getInitialState = function () { return immer_esm(initialState(), function () { }); }; } else { var frozenInitialState_1 = immer_esm(initialState, function () { }); getInitialState = function () { return frozenInitialState_1; }; } function reducer(state, action) { if (state === void 0) { state = getInitialState(); } var caseReducers = __spreadArray([ actionsMap[action.type] ], finalActionMatchers.filter(function (_c) { var matcher = _c.matcher; return matcher(action); }).map(function (_c) { var reducer2 = _c.reducer; return reducer2; })); if (caseReducers.filter(function (cr) { return !!cr; }).length === 0) { caseReducers = [finalDefaultCaseReducer]; } return caseReducers.reduce(function (previousState, caseReducer) { if (caseReducer) { if (r(previousState)) { var draft = previousState; var result = caseReducer(draft, action); if (typeof result === "undefined") { return previousState; } return result; } else if (!t(previousState)) { var result = caseReducer(previousState, action); if (typeof result === "undefined") { if (previousState === null) { return previousState; } throw Error("A case reducer on a non-draftable value must not return undefined"); } return result; } else { return immer_esm(previousState, function (draft) { return caseReducer(draft, action); }); } } return previousState; }, state); } reducer.getInitialState = getInitialState; return reducer; } // src/createSlice.ts function getType2(slice, actionKey) { return slice + "/" + actionKey; } function createSlice(options) { var name = options.name; if (!name) { throw new Error("`name` is a required option for createSlice"); } var initialState = typeof options.initialState == "function" ? options.initialState : immer_esm(options.initialState, function () { }); var reducers = options.reducers || {}; var reducerNames = Object.keys(reducers); var sliceCaseReducersByName = {}; var sliceCaseReducersByType = {}; var actionCreators = {}; reducerNames.forEach(function (reducerName) { var maybeReducerWithPrepare = reducers[reducerName]; var type = getType2(name, reducerName); var caseReducer; var prepareCallback; if ("reducer" in maybeReducerWithPrepare) { caseReducer = maybeReducerWithPrepare.reducer; prepareCallback = maybeReducerWithPrepare.prepare; } else { caseReducer = maybeReducerWithPrepare; } sliceCaseReducersByName[reducerName] = caseReducer; sliceCaseReducersByType[type] = caseReducer; actionCreators[reducerName] = prepareCallback ? createAction(type, prepareCallback) : createAction(type); }); function buildReducer() { var _c = typeof options.extraReducers === "function" ? executeReducerBuilderCallback(options.extraReducers) : [options.extraReducers], _d = _c[0], extraReducers = _d === void 0 ? {} : _d, _e = _c[1], actionMatchers = _e === void 0 ? [] : _e, _f = _c[2], defaultCaseReducer = _f === void 0 ? void 0 : _f; var finalCaseReducers = __spreadValues(__spreadValues({}, extraReducers), sliceCaseReducersByType); return createReducer(initialState, finalCaseReducers, actionMatchers, defaultCaseReducer); } var _reducer; return { name: name, reducer: function (state, action) { if (!_reducer) _reducer = buildReducer(); return _reducer(state, action); }, actions: actionCreators, caseReducers: sliceCaseReducersByName, getInitialState: function () { if (!_reducer) _reducer = buildReducer(); return _reducer.getInitialState(); } }; } // src/entities/entity_state.ts function getInitialEntityState() { return { ids: [], entities: {} }; } function createInitialStateFactory() { function getInitialState(additionalState) { if (additionalState === void 0) { additionalState = {}; } return Object.assign(getInitialEntityState(), additionalState); } return { getInitialState: getInitialState }; } // src/entities/state_selectors.ts function createSelectorsFactory() { function getSelectors(selectState) { var selectIds = function (state) { return state.ids; }; var selectEntities = function (state) { return state.entities; }; var selectAll = createDraftSafeSelector(selectIds, selectEntities, function (ids, entities) { return ids.map(function (id) { return entities[id]; }); }); var selectId = function (_, id) { return id; }; var selectById = function (entities, id) { return entities[id]; }; var selectTotal = createDraftSafeSelector(selectIds, function (ids) { return ids.length; }); if (!selectState) { return { selectIds: selectIds, selectEntities: selectEntities, selectAll: selectAll, selectTotal: selectTotal, selectById: createDraftSafeSelector(selectEntities, selectId, selectById) }; } var selectGlobalizedEntities = createDraftSafeSelector(selectState, selectEntities); return { selectIds: createDraftSafeSelector(selectState, selectIds), selectEntities: selectGlobalizedEntities, selectAll: createDraftSafeSelector(selectState, selectAll), selectTotal: createDraftSafeSelector(selectState, selectTotal), selectById: createDraftSafeSelector(selectGlobalizedEntities, selectId, selectById) }; } return { getSelectors: getSelectors }; } // src/entities/state_adapter.ts function createSingleArgumentStateOperator(mutator) { var operator = createStateOperator(function (_, state) { return mutator(state); }); return function operation(state) { return operator(state, void 0); }; } function createStateOperator(mutator) { return function operation(state, arg) { function isPayloadActionArgument(arg2) { return isFSA(arg2); } var runMutator = function (draft) { if (isPayloadActionArgument(arg)) { mutator(arg.payload, draft); } else { mutator(arg, draft); } }; if (isDraft3(state)) { runMutator(state); return state; } else { return createNextState2(state, runMutator); } }; } // src/entities/utils.ts function selectIdValue(entity, selectId) { var key = selectId(entity); if (false) {} return key; } function ensureEntitiesArray(entities) { if (!Array.isArray(entities)) { entities = Object.values(entities); } return entities; } function splitAddedUpdatedEntities(newEntities, selectId, state) { newEntities = ensureEntitiesArray(newEntities); var added = []; var updated = []; for (var _i = 0, newEntities_1 = newEntities; _i < newEntities_1.length; _i++) { var entity = newEntities_1[_i]; var id = selectIdValue(entity, selectId); if (id in state.entities) { updated.push({ id: id, changes: entity }); } else { added.push(entity); } } return [added, updated]; } // src/entities/unsorted_state_adapter.ts function createUnsortedStateAdapter(selectId) { function addOneMutably(entity, state) { var key = selectIdValue(entity, selectId); if (key in state.entities) { return; } state.ids.push(key); state.entities[key] = entity; } function addManyMutably(newEntities, state) { newEntities = ensureEntitiesArray(newEntities); for (var _i = 0, newEntities_2 = newEntities; _i < newEntities_2.length; _i++) { var entity = newEntities_2[_i]; addOneMutably(entity, state); } } function setOneMutably(entity, state) { var key = selectIdValue(entity, selectId); if (!(key in state.entities)) { state.ids.push(key); } state.entities[key] = entity; } function setManyMutably(newEntities, state) { newEntities = ensureEntitiesArray(newEntities); for (var _i = 0, newEntities_3 = newEntities; _i < newEntities_3.length; _i++) { var entity = newEntities_3[_i]; setOneMutably(entity, state); } } function setAllMutably(newEntities, state) { newEntities = ensureEntitiesArray(newEntities); state.ids = []; state.entities = {}; addManyMutably(newEntities, state); } function removeOneMutably(key, state) { return removeManyMutably([key], state); } function removeManyMutably(keys, state) { var didMutate = false; keys.forEach(function (key) { if (key in state.entities) { delete state.entities[key]; didMutate = true; } }); if (didMutate) { state.ids = state.ids.filter(function (id) { return id in state.entities; }); } } function removeAllMutably(state) { Object.assign(state, { ids: [], entities: {} }); } function takeNewKey(keys, update, state) { var original2 = state.entities[update.id]; var updated = Object.assign({}, original2, update.changes); var newKey = selectIdValue(updated, selectId); var hasNewKey = newKey !== update.id; if (hasNewKey) { keys[update.id] = newKey; delete state.entities[update.id]; } state.entities[newKey] = updated; return hasNewKey; } function updateOneMutably(update, state) { return updateManyMutably([update], state); } function updateManyMutably(updates, state) { var newKeys = {}; var updatesPerEntity = {}; updates.forEach(function (update) { if (update.id in state.entities) { updatesPerEntity[update.id] = { id: update.id, changes: __spreadValues(__spreadValues({}, updatesPerEntity[update.id] ? updatesPerEntity[update.id].changes : null), update.changes) }; } }); updates = Object.values(updatesPerEntity); var didMutateEntities = updates.length > 0; if (didMutateEntities) { var didMutateIds = updates.filter(function (update) { return takeNewKey(newKeys, update, state); }).length > 0; if (didMutateIds) { state.ids = state.ids.map(function (id) { return newKeys[id] || id; }); } } } function upsertOneMutably(entity, state) { return upsertManyMutably([entity], state); } function upsertManyMutably(newEntities, state) { var _c = splitAddedUpdatedEntities(newEntities, selectId, state), added = _c[0], updated = _c[1]; updateManyMutably(updated, state); addManyMutably(added, state); } return { removeAll: createSingleArgumentStateOperator(removeAllMutably), addOne: createStateOperator(addOneMutably), addMany: createStateOperator(addManyMutably), setOne: createStateOperator(setOneMutably), setMany: createStateOperator(setManyMutably), setAll: createStateOperator(setAllMutably), updateOne: createStateOperator(updateOneMutably), updateMany: createStateOperator(updateManyMutably), upsertOne: createStateOperator(upsertOneMutably), upsertMany: createStateOperator(upsertManyMutably), removeOne: createStateOperator(removeOneMutably), removeMany: createStateOperator(removeManyMutably) }; } // src/entities/sorted_state_adapter.ts function createSortedStateAdapter(selectId, sort) { var _c = createUnsortedStateAdapter(selectId), removeOne = _c.removeOne, removeMany = _c.removeMany, removeAll = _c.removeAll; function addOneMutably(entity, state) { return addManyMutably([entity], state); } function addManyMutably(newEntities, state) { newEntities = ensureEntitiesArray(newEntities); var models = newEntities.filter(function (model) { return !(selectIdValue(model, selectId) in state.entities); }); if (models.length !== 0) { merge(models, state); } } function setOneMutably(entity, state) { return setManyMutably([entity], state); } function setManyMutably(newEntities, state) { newEntities = ensureEntitiesArray(newEntities); if (newEntities.length !== 0) { merge(newEntities, state); } } function setAllMutably(newEntities, state) { newEntities = ensureEntitiesArray(newEntities); state.entities = {}; state.ids = []; addManyMutably(newEntities, state); } function updateOneMutably(update, state) { return updateManyMutably([update], state); } function takeUpdatedModel(models, update, state) { if (!(update.id in state.entities)) { return false; } var original2 = state.entities[update.id]; var updated = Object.assign({}, original2, update.changes); var newKey = selectIdValue(updated, selectId); delete state.entities[update.id]; models.push(updated); return newKey !== update.id; } function updateManyMutably(updates, state) { var models = []; updates.forEach(function (update) { return takeUpdatedModel(models, update, state); }); if (models.length !== 0) { merge(models, state); } } function upsertOneMutably(entity, state) { return upsertManyMutably([entity], state); } function upsertManyMutably(newEntities, state) { var _c = splitAddedUpdatedEntities(newEntities, selectId, state), added = _c[0], updated = _c[1]; updateManyMutably(updated, state); addManyMutably(added, state); } function areArraysEqual(a, b) { if (a.length !== b.length) { return false; } for (var i = 0; i < a.length && i < b.length; i++) { if (a[i] === b[i]) { continue; } return false; } return true; } function merge(models, state) { models.forEach(function (model) { state.entities[selectId(model)] = model; }); var allEntities = Object.values(state.entities); allEntities.sort(sort); var newSortedIds = allEntities.map(selectId); var ids = state.ids; if (!areArraysEqual(ids, newSortedIds)) { state.ids = newSortedIds; } } return { removeOne: removeOne, removeMany: removeMany, removeAll: removeAll, addOne: createStateOperator(addOneMutably), updateOne: createStateOperator(updateOneMutably), upsertOne: createStateOperator(upsertOneMutably), setOne: createStateOperator(setOneMutably), setMany: createStateOperator(setManyMutably), setAll: createStateOperator(setAllMutably), addMany: createStateOperator(addManyMutably), updateMany: createStateOperator(updateManyMutably), upsertMany: createStateOperator(upsertManyMutably) }; } // src/entities/create_adapter.ts function createEntityAdapter(options) { if (options === void 0) { options = {}; } var _c = __spreadValues({ sortComparer: false, selectId: function (instance) { return instance.id; } }, options), selectId = _c.selectId, sortComparer = _c.sortComparer; var stateFactory = createInitialStateFactory(); var selectorsFactory = createSelectorsFactory(); var stateAdapter = sortComparer ? createSortedStateAdapter(selectId, sortComparer) : createUnsortedStateAdapter(selectId); return __spreadValues(__spreadValues(__spreadValues({ selectId: selectId, sortComparer: sortComparer }, stateFactory), selectorsFactory), stateAdapter); } // src/nanoid.ts var urlAlphabet = "ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"; var nanoid = function (size) { if (size === void 0) { size = 21; } var id = ""; var i = size; while (i--) { id += urlAlphabet[Math.random() * 64 | 0]; } return id; }; // src/createAsyncThunk.ts var commonProperties = [ "name", "message", "stack", "code" ]; var RejectWithValue = /** @class */ (function () { function RejectWithValue(payload, meta) { this.payload = payload; this.meta = meta; } return RejectWithValue; }()); var FulfillWithMeta = /** @class */ (function () { function FulfillWithMeta(payload, meta) { this.payload = payload; this.meta = meta; } return FulfillWithMeta; }()); var miniSerializeError = function (value) { if (typeof value === "object" && value !== null) { var simpleError = {}; for (var _i = 0, commonProperties_1 = commonProperties; _i < commonProperties_1.length; _i++) { var property = commonProperties_1[_i]; if (typeof value[property] === "string") { simpleError[property] = value[property]; } } return simpleError; } return { message: String(value) }; }; function createAsyncThunk(typePrefix, payloadCreator, options) { var fulfilled = createAction(typePrefix + "/fulfilled", function (payload, requestId, arg, meta) { return ({ payload: payload, meta: __spreadProps(__spreadValues({}, meta || {}), { arg: arg, requestId: requestId, requestStatus: "fulfilled" }) }); }); var pending = createAction(typePrefix + "/pending", function (requestId, arg, meta) { return ({ payload: void 0, meta: __spreadProps(__spreadValues({}, meta || {}), { arg: arg, requestId: requestId, requestStatus: "pending" }) }); }); var rejected = createAction(typePrefix + "/rejected", function (error, requestId, arg, payload, meta) { return ({ payload: payload, error: (options && options.serializeError || miniSerializeError)(error || "Rejected"), meta: __spreadProps(__spreadValues({}, meta || {}), { arg: arg, requestId: requestId, rejectedWithValue: !!payload, requestStatus: "rejected", aborted: (error == null ? void 0 : error.name) === "AbortError", condition: (error == null ? void 0 : error.name) === "ConditionError" }) }); }); var displayedWarning = false; var AC = typeof AbortController !== "undefined" ? AbortController : /** @class */ (function () { function class_1() { this.signal = { aborted: false, addEventListener: function () { }, dispatchEvent: function () { return false; }, onabort: function () { }, removeEventListener: function () { } }; } class_1.prototype.abort = function () { if (false) {} }; return class_1; }()); function actionCreator(arg) { return function (dispatch, getState, extra) { var requestId = (options == null ? void 0 : options.idGenerator) ? options.idGenerator(arg) : nanoid(); var abortController = new AC(); var abortReason; var abortedPromise = new Promise(function (_, reject) { return abortController.signal.addEventListener("abort", function () { return reject({ name: "AbortError", message: abortReason || "Aborted" }); }); }); var started = false; function abort(reason) { if (started) { abortReason = reason; abortController.abort(); } } var promise = function () { return __async(this, null, function () { var _a, _b, finalAction, conditionResult, err_1, skipDispatch; return __generator(this, function (_c) { switch (_c.label) { case 0: _c.trys.push([0, 4, , 5]); conditionResult = (_a = options == null ? void 0 : options.condition) == null ? void 0 : _a.call(options, arg, { getState: getState, extra: extra }); if (!isThenable(conditionResult)) return [3 /*break*/, 2]; return [4 /*yield*/, conditionResult]; case 1: conditionResult = _c.sent(); _c.label = 2; case 2: if (conditionResult === false) { throw { name: "ConditionError", message: "Aborted due to condition callback returning false." }; } started = true; dispatch(pending(requestId, arg, (_b = options == null ? void 0 : options.getPendingMeta) == null ? void 0 : _b.call(options, { requestId: requestId, arg: arg }, { getState: getState, extra: extra }))); return [4 /*yield*/, Promise.race([ abortedPromise, Promise.resolve(payloadCreator(arg, { dispatch: dispatch, getState: getState, extra: extra, requestId: requestId, signal: abortController.signal, rejectWithValue: function (value, meta) { return new RejectWithValue(value, meta); }, fulfillWithValue: function (value, meta) { return new FulfillWithMeta(value, meta); } })).then(function (result) { if (result instanceof RejectWithValue) { throw result; } if (result instanceof FulfillWithMeta) { return fulfilled(result.payload, requestId, arg, result.meta); } return fulfilled(result, requestId, arg); }) ])]; case 3: finalAction = _c.sent(); return [3 /*break*/, 5]; case 4: err_1 = _c.sent(); finalAction = err_1 instanceof RejectWithValue ? rejected(null, requestId, arg, err_1.payload, err_1.meta) : rejected(err_1, requestId, arg); return [3 /*break*/, 5]; case 5: skipDispatch = options && !options.dispatchConditionRejection && rejected.match(finalAction) && finalAction.meta.condition; if (!skipDispatch) { dispatch(finalAction); } return [2 /*return*/, finalAction]; } }); }); }(); return Object.assign(promise, { abort: abort, requestId: requestId, arg: arg, unwrap: function () { return promise.then(unwrapResult); } }); }; } return Object.assign(actionCreator, { pending: pending, rejected: rejected, fulfilled: fulfilled, typePrefix: typePrefix }); } function unwrapResult(action) { if (action.meta && action.meta.rejectedWithValue) { throw action.payload; } if (action.error) { throw action.error; } return action.payload; } function isThenable(value) { return value !== null && typeof value === "object" && typeof value.then === "function"; } // src/tsHelpers.ts var hasMatchFunction = function (v) { return v && typeof v.match === "function"; }; // src/matchers.ts var matches = function (matcher, action) { if (hasMatchFunction(matcher)) { return matcher.match(action); } else { return matcher(action); } }; function isAnyOf() { var matchers = []; for (var _i = 0; _i < arguments.length; _i++) { matchers[_i] = arguments[_i]; } return function (action) { return matchers.some(function (matcher) { return matches(matcher, action); }); }; } function isAllOf() { var matchers = []; for (var _i = 0; _i < arguments.length; _i++) { matchers[_i] = arguments[_i]; } return function (action) { return matchers.every(function (matcher) { return matches(matcher, action); }); }; } function hasExpectedRequestMetadata(action, validStatus) { if (!action || !action.meta) return false; var hasValidRequestId = typeof action.meta.requestId === "string"; var hasValidRequestStatus = validStatus.indexOf(action.meta.requestStatus) > -1; return hasValidRequestId && hasValidRequestStatus; } function isAsyncThunkArray(a) { return typeof a[0] === "function" && "pending" in a[0] && "fulfilled" in a[0] && "rejected" in a[0]; } function isPending() { var asyncThunks = []; for (var _i = 0; _i < arguments.length; _i++) { asyncThunks[_i] = arguments[_i]; } if (asyncThunks.length === 0) { return function (action) { return hasExpectedRequestMetadata(action, ["pending"]); }; } if (!isAsyncThunkArray(asyncThunks)) { return isPending()(asyncThunks[0]); } return function (action) { var matchers = asyncThunks.map(function (asyncThunk) { return asyncThunk.pending; }); var combinedMatcher = isAnyOf.apply(void 0, matchers); return combinedMatcher(action); }; } function isRejected() { var asyncThunks = []; for (var _i = 0; _i < arguments.length; _i++) { asyncThunks[_i] = arguments[_i]; } if (asyncThunks.length === 0) { return function (action) { return hasExpectedRequestMetadata(action, ["rejected"]); }; } if (!isAsyncThunkArray(asyncThunks)) { return isRejected()(asyncThunks[0]); } return function (action) { var matchers = asyncThunks.map(function (asyncThunk) { return asyncThunk.rejected; }); var combinedMatcher = isAnyOf.apply(void 0, matchers); return combinedMatcher(action); }; } function isRejectedWithValue() { var asyncThunks = []; for (var _i = 0; _i < arguments.length; _i++) { asyncThunks[_i] = arguments[_i]; } var hasFlag = function (action) { return action && action.meta && action.meta.rejectedWithValue; }; if (asyncThunks.length === 0) { return function (action) { var combinedMatcher = isAllOf(isRejected.apply(void 0, asyncThunks), hasFlag); return combinedMatcher(action); }; } if (!isAsyncThunkArray(asyncThunks)) { return isRejectedWithValue()(asyncThunks[0]); } return function (action) { var combinedMatcher = isAllOf(isRejected.apply(void 0, asyncThunks), hasFlag); return combinedMatcher(action); }; } function isFulfilled() { var asyncThunks = []; for (var _i = 0; _i < arguments.length; _i++) { asyncThunks[_i] = arguments[_i]; } if (asyncThunks.length === 0) { return function (action) { return hasExpectedRequestMetadata(action, ["fulfilled"]); }; } if (!isAsyncThunkArray(asyncThunks)) { return isFulfilled()(asyncThunks[0]); } return function (action) { var matchers = asyncThunks.map(function (asyncThunk) { return asyncThunk.fulfilled; }); var combinedMatcher = isAnyOf.apply(void 0, matchers); return combinedMatcher(action); }; } function isAsyncThunkAction() { var asyncThunks = []; for (var _i = 0; _i < arguments.length; _i++) { asyncThunks[_i] = arguments[_i]; } if (asyncThunks.length === 0) { return function (action) { return hasExpectedRequestMetadata(action, ["pending", "fulfilled", "rejected"]); }; } if (!isAsyncThunkArray(asyncThunks)) { return isAsyncThunkAction()(asyncThunks[0]); } return function (action) { var matchers = []; for (var _i = 0, asyncThunks_1 = asyncThunks; _i < asyncThunks_1.length; _i++) { var asyncThunk = asyncThunks_1[_i]; matchers.push(asyncThunk.pending, asyncThunk.rejected, asyncThunk.fulfilled); } var combinedMatcher = isAnyOf.apply(void 0, matchers); return combinedMatcher(action); }; } // src/listenerMiddleware/utils.ts var assertFunction = function (func, expected) { if (typeof func !== "function") { throw new TypeError(expected + " is not a function"); } }; var noop = function () { }; var catchRejection = function (promise, onError) { if (onError === void 0) { onError = noop; } promise.catch(onError); return promise; }; var addAbortSignalListener = function (abortSignal, callback) { abortSignal.addEventListener("abort", callback, { once: true }); }; var abortControllerWithReason = function (abortController, reason) { var signal = abortController.signal; if (signal.aborted) { return; } if (!("reason" in signal)) { Object.defineProperty(signal, "reason", { enumerable: true, value: reason, configurable: true, writable: true }); } ; abortController.abort(reason); }; // src/listenerMiddleware/exceptions.ts var task = "task"; var listener = "listener"; var completed = "completed"; var cancelled = "cancelled"; var taskCancelled = "task-" + cancelled; var taskCompleted = "task-" + completed; var listenerCancelled = listener + "-" + cancelled; var listenerCompleted = listener + "-" + completed; var TaskAbortError = /** @class */ (function () { function TaskAbortError(code) { this.code = code; this.name = "TaskAbortError"; this.message = task + " " + cancelled + " (reason: " + code + ")"; } return TaskAbortError; }()); // src/listenerMiddleware/task.ts var validateActive = function (signal) { if (signal.aborted) { throw new TaskAbortError(signal.reason); } }; var promisifyAbortSignal = function (signal) { return catchRejection(new Promise(function (_, reject) { var notifyRejection = function () { return reject(new TaskAbortError(signal.reason)); }; if (signal.aborted) { notifyRejection(); } else { addAbortSignalListener(signal, notifyRejection); } })); }; var runTask = function (task2, cleanUp) { return __async(void 0, null, function () { var value, error_1; return __generator(this, function (_c) { switch (_c.label) { case 0: _c.trys.push([0, 3, 4, 5]); return [4 /*yield*/, Promise.resolve()]; case 1: _c.sent(); return [4 /*yield*/, task2()]; case 2: value = _c.sent(); return [2 /*return*/, { status: "ok", value: value }]; case 3: error_1 = _c.sent(); return [2 /*return*/, { status: error_1 instanceof TaskAbortError ? "cancelled" : "rejected", error: error_1 }]; case 4: cleanUp == null ? void 0 : cleanUp(); return [7 /*endfinally*/]; case 5: return [2 /*return*/]; } }); }); }; var createPause = function (signal) { return function (promise) { return catchRejection(Promise.race([promisifyAbortSignal(signal), promise]).then(function (output) { validateActive(signal); return output; })); }; }; var createDelay = function (signal) { var pause = createPause(signal); return function (timeoutMs) { return pause(new Promise(function (resolve) { return setTimeout(resolve, timeoutMs); })); }; }; // src/listenerMiddleware/index.ts var redux_toolkit_esm_assign = Object.assign; var INTERNAL_NIL_TOKEN = {}; var alm = "listenerMiddleware"; var createFork = function (parentAbortSignal) { var linkControllers = function (controller) { return addAbortSignalListener(parentAbortSignal, function () { return abortControllerWithReason(controller, parentAbortSignal.reason); }); }; return function (taskExecutor) { assertFunction(taskExecutor, "taskExecutor"); var childAbortController = new AbortController(); linkControllers(childAbortController); var result = runTask(function () { return __async(void 0, null, function () { var result2; return __generator(this, function (_c) { switch (_c.label) { case 0: validateActive(parentAbortSignal); validateActive(childAbortController.signal); return [4 /*yield*/, taskExecutor({ pause: createPause(childAbortController.signal), delay: createDelay(childAbortController.signal), signal: childAbortController.signal })]; case 1: result2 = _c.sent(); validateActive(childAbortController.signal); return [2 /*return*/, result2]; } }); }); }, function () { return abortControllerWithReason(childAbortController, taskCompleted); }); return { result: createPause(parentAbortSignal)(result), cancel: function () { abortControllerWithReason(childAbortController, taskCancelled); } }; }; }; var createTakePattern = function (startListening, signal) { var take = function (predicate, timeout) { return __async(void 0, null, function () { var unsubscribe, tuplePromise, promises, output; return __generator(this, function (_c) { switch (_c.label) { case 0: validateActive(signal); unsubscribe = function () { }; tuplePromise = new Promise(function (resolve) { unsubscribe = startListening({ predicate: predicate, effect: function (action, listenerApi) { listenerApi.unsubscribe(); resolve([ action, listenerApi.getState(), listenerApi.getOriginalState() ]); } }); }); promises = [ promisifyAbortSignal(signal), tuplePromise ]; if (timeout != null) { promises.push(new Promise(function (resolve) { return setTimeout(resolve, timeout, null); })); } _c.label = 1; case 1: _c.trys.push([1, , 3, 4]); return [4 /*yield*/, Promise.race(promises)]; case 2: output = _c.sent(); validateActive(signal); return [2 /*return*/, output]; case 3: unsubscribe(); return [7 /*endfinally*/]; case 4: return [2 /*return*/]; } }); }); }; return function (predicate, timeout) { return catchRejection(take(predicate, timeout)); }; }; var getListenerEntryPropsFrom = function (options) { var type = options.type, actionCreator = options.actionCreator, matcher = options.matcher, predicate = options.predicate, effect = options.effect; if (type) { predicate = createAction(type).match; } else if (actionCreator) { type = actionCreator.type; predicate = actionCreator.match; } else if (matcher) { predicate = matcher; } else if (predicate) { } else { throw new Error("Creating or removing a listener requires one of the known fields for matching an action"); } assertFunction(effect, "options.listener"); return { predicate: predicate, type: type, effect: effect }; }; var createListenerEntry = function (options) { var _c = getListenerEntryPropsFrom(options), type = _c.type, predicate = _c.predicate, effect = _c.effect; var id = nanoid(); var entry = { id: id, effect: effect, type: type, predicate: predicate, pending: new Set(), unsubscribe: function () { throw new Error("Unsubscribe not initialized"); } }; return entry; }; var createClearListenerMiddleware = function (listenerMap) { return function () { listenerMap.forEach(cancelActiveListeners); listenerMap.clear(); }; }; var safelyNotifyError = function (errorHandler, errorToNotify, errorInfo) { try { errorHandler(errorToNotify, errorInfo); } catch (errorHandlerError) { setTimeout(function () { throw errorHandlerError; }, 0); } }; var addListener = createAction(alm + "/add"); var clearAllListeners = createAction(alm + "/removeAll"); var removeListener = createAction(alm + "/remove"); var defaultErrorHandler = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } console.error.apply(console, __spreadArray([alm + "/error"], args)); }; var cancelActiveListeners = function (entry) { entry.pending.forEach(function (controller) { abortControllerWithReason(controller, listenerCancelled); }); }; function createListenerMiddleware(middlewareOptions) { var _this = this; if (middlewareOptions === void 0) { middlewareOptions = {}; } var listenerMap = new Map(); var extra = middlewareOptions.extra, _c = middlewareOptions.onError, onError = _c === void 0 ? defaultErrorHandler : _c; assertFunction(onError, "onError"); var insertEntry = function (entry) { entry.unsubscribe = function () { return listenerMap.delete(entry.id); }; listenerMap.set(entry.id, entry); return function (cancelOptions) { entry.unsubscribe(); if (cancelOptions == null ? void 0 : cancelOptions.cancelActive) { cancelActiveListeners(entry); } }; }; var findListenerEntry = function (comparator) { for (var _i = 0, _c = Array.from(listenerMap.values()); _i < _c.length; _i++) { var entry = _c[_i]; if (comparator(entry)) { return entry; } } return void 0; }; var startListening = function (options) { var entry = findListenerEntry(function (existingEntry) { return existingEntry.effect === options.effect; }); if (!entry) { entry = createListenerEntry(options); } return insertEntry(entry); }; var stopListening = function (options) { var _c = getListenerEntryPropsFrom(options), type = _c.type, effect = _c.effect, predicate = _c.predicate; var entry = findListenerEntry(function (entry2) { var matchPredicateOrType = typeof type === "string" ? entry2.type === type : entry2.predicate === predicate; return matchPredicateOrType && entry2.effect === effect; }); if (entry) { entry.unsubscribe(); if (options.cancelActive) { cancelActiveListeners(entry); } } return !!entry; }; var notifyListener = function (entry, action, api, getOriginalState) { return __async(_this, null, function () { var internalTaskController, take, listenerError_1; return __generator(this, function (_c) { switch (_c.label) { case 0: internalTaskController = new AbortController(); take = createTakePattern(startListening, internalTaskController.signal); _c.label = 1; case 1: _c.trys.push([1, 3, 4, 5]); entry.pending.add(internalTaskController); return [4 /*yield*/, Promise.resolve(entry.effect(action, redux_toolkit_esm_assign({}, api, { getOriginalState: getOriginalState, condition: function (predicate, timeout) { return take(predicate, timeout).then(Boolean); }, take: take, delay: createDelay(internalTaskController.signal), pause: createPause(internalTaskController.signal), extra: extra, signal: internalTaskController.signal, fork: createFork(internalTaskController.signal), unsubscribe: entry.unsubscribe, subscribe: function () { listenerMap.set(entry.id, entry); }, cancelActiveListeners: function () { entry.pending.forEach(function (controller, _, set) { if (controller !== internalTaskController) { abortControllerWithReason(controller, listenerCancelled); set.delete(controller); } }); } })))]; case 2: _c.sent(); return [3 /*break*/, 5]; case 3: listenerError_1 = _c.sent(); if (!(listenerError_1 instanceof TaskAbortError)) { safelyNotifyError(onError, listenerError_1, { raisedBy: "effect" }); } return [3 /*break*/, 5]; case 4: abortControllerWithReason(internalTaskController, listenerCompleted); entry.pending.delete(internalTaskController); return [7 /*endfinally*/]; case 5: return [2 /*return*/]; } }); }); }; var clearListenerMiddleware = createClearListenerMiddleware(listenerMap); var middleware = function (api) { return function (next) { return function (action) { if (addListener.match(action)) { return startListening(action.payload); } if (clearAllListeners.match(action)) { clearListenerMiddleware(); return; } if (removeListener.match(action)) { return stopListening(action.payload); } var originalState = api.getState(); var getOriginalState = function () { if (originalState === INTERNAL_NIL_TOKEN) { throw new Error(alm + ": getOriginalState can only be called synchronously"); } return originalState; }; var result; try { result = next(action); if (listenerMap.size > 0) { var currentState = api.getState(); var listenerEntries = Array.from(listenerMap.values()); for (var _i = 0, listenerEntries_1 = listenerEntries; _i < listenerEntries_1.length; _i++) { var entry = listenerEntries_1[_i]; var runListener = false; try { runListener = entry.predicate(action, currentState, originalState); } catch (predicateError) { runListener = false; safelyNotifyError(onError, predicateError, { raisedBy: "predicate" }); } if (!runListener) { continue; } notifyListener(entry, action, api, getOriginalState); } } } finally { originalState = INTERNAL_NIL_TOKEN; } return result; }; }; }; return { middleware: middleware, startListening: startListening, stopListening: stopListening, clearListeners: clearListenerMiddleware }; } // src/index.ts N(); //# sourceMappingURL=redux-toolkit.esm.js.map /***/ }), /***/ 84773: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "GJ": function() { return /* binding */ exceptionFromError; }, /* harmony export */ "ME": function() { return /* binding */ eventFromUnknownInput; }, /* harmony export */ "aB": function() { return /* binding */ eventFromMessage; }, /* harmony export */ "dr": function() { return /* binding */ eventFromException; } /* harmony export */ }); /* unused harmony exports eventFromError, eventFromPlainObject, eventFromString, parseStackFrames */ /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(67597); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(20535); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(34754); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(62844); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(96893); /** * This function creates an exception from a JavaScript Error */ function exceptionFromError(stackParser, ex) { // Get the frames first since Opera can lose the stack if we touch anything else first var frames = parseStackFrames(stackParser, ex); var exception = { type: ex && ex.name, value: extractMessage(ex), }; if (frames.length) { exception.stacktrace = { frames }; } if (exception.type === undefined && exception.value === '') { exception.value = 'Unrecoverable error caught'; } return exception; } /** * @hidden */ function eventFromPlainObject( stackParser, exception, syntheticException, isUnhandledRejection, ) { var event = { exception: { values: [ { type: (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__/* .isEvent */ .cO)(exception) ? exception.constructor.name : isUnhandledRejection ? 'UnhandledRejection' : 'Error', value: `Non-Error ${ isUnhandledRejection ? 'promise rejection' : 'exception' } captured with keys: ${(0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__/* .extractExceptionKeysForMessage */ .zf)(exception)}`, }, ], }, extra: { __serialized__: (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_2__/* .normalizeToSize */ .Qy)(exception), }, }; if (syntheticException) { var frames = parseStackFrames(stackParser, syntheticException); if (frames.length) { // event.exception.values[0] has been set above (event.exception ).values[0].stacktrace = { frames }; } } return event; } /** * @hidden */ function eventFromError(stackParser, ex) { return { exception: { values: [exceptionFromError(stackParser, ex)], }, }; } /** Parses stack frames from an error */ function parseStackFrames( stackParser, ex, ) { // Access and store the stacktrace property before doing ANYTHING // else to it because Opera is not very good at providing it // reliably in other circumstances. var stacktrace = ex.stacktrace || ex.stack || ''; var popSize = getPopSize(ex); try { return stackParser(stacktrace, popSize); } catch (e) { // no-empty } return []; } // Based on our own mapping pattern - https://github.com/getsentry/sentry/blob/9f08305e09866c8bd6d0c24f5b0aabdd7dd6c59c/src/sentry/lang/javascript/errormapping.py#L83-L108 var reactMinifiedRegexp = /Minified React error #\d+;/i; function getPopSize(ex) { if (ex) { if (typeof ex.framesToPop === 'number') { return ex.framesToPop; } if (reactMinifiedRegexp.test(ex.message)) { return 1; } } return 0; } /** * There are cases where stacktrace.message is an Event object * https://github.com/getsentry/sentry-javascript/issues/1949 * In this specific case we try to extract stacktrace.message.error.message */ function extractMessage(ex) { var message = ex && ex.message; if (!message) { return 'No error message'; } if (message.error && typeof message.error.message === 'string') { return message.error.message; } return message; } /** * Creates an {@link Event} from all inputs to `captureException` and non-primitive inputs to `captureMessage`. * @hidden */ function eventFromException( stackParser, exception, hint, attachStacktrace, ) { var syntheticException = (hint && hint.syntheticException) || undefined; var event = eventFromUnknownInput(stackParser, exception, syntheticException, attachStacktrace); (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_3__/* .addExceptionMechanism */ .EG)(event); // defaults to { type: 'generic', handled: true } event.level = 'error'; if (hint && hint.event_id) { event.event_id = hint.event_id; } return (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_4__/* .resolvedSyncPromise */ .WD)(event); } /** * Builds and Event from a Message * @hidden */ function eventFromMessage( stackParser, message, level = 'info', hint, attachStacktrace, ) { var syntheticException = (hint && hint.syntheticException) || undefined; var event = eventFromString(stackParser, message, syntheticException, attachStacktrace); event.level = level; if (hint && hint.event_id) { event.event_id = hint.event_id; } return (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_4__/* .resolvedSyncPromise */ .WD)(event); } /** * @hidden */ function eventFromUnknownInput( stackParser, exception, syntheticException, attachStacktrace, isUnhandledRejection, ) { let event; if ((0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__/* .isErrorEvent */ .VW)(exception ) && (exception ).error) { // If it is an ErrorEvent with `error` property, extract it to get actual Error var errorEvent = exception ; return eventFromError(stackParser, errorEvent.error ); } // If it is a `DOMError` (which is a legacy API, but still supported in some browsers) then we just extract the name // and message, as it doesn't provide anything else. According to the spec, all `DOMExceptions` should also be // `Error`s, but that's not the case in IE11, so in that case we treat it the same as we do a `DOMError`. // // https://developer.mozilla.org/en-US/docs/Web/API/DOMError // https://developer.mozilla.org/en-US/docs/Web/API/DOMException // https://webidl.spec.whatwg.org/#es-DOMException-specialness if ((0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__/* .isDOMError */ .TX)(exception ) || (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__/* .isDOMException */ .fm)(exception )) { var domException = exception ; if ('stack' in (exception )) { event = eventFromError(stackParser, exception ); } else { var name = domException.name || ((0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__/* .isDOMError */ .TX)(domException) ? 'DOMError' : 'DOMException'); var message = domException.message ? `${name}: ${domException.message}` : name; event = eventFromString(stackParser, message, syntheticException, attachStacktrace); (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_3__/* .addExceptionTypeValue */ .Db)(event, message); } if ('code' in domException) { event.tags = { ...event.tags, 'DOMException.code': `${domException.code}` }; } return event; } if ((0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__/* .isError */ .VZ)(exception)) { // we have a real Error object, do nothing return eventFromError(stackParser, exception); } if ((0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__/* .isPlainObject */ .PO)(exception) || (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__/* .isEvent */ .cO)(exception)) { // If it's a plain object or an instance of `Event` (the built-in JS kind, not this SDK's `Event` type), serialize // it manually. This will allow us to group events based on top-level keys which is much better than creating a new // group on any key/value change. var objectException = exception ; event = eventFromPlainObject(stackParser, objectException, syntheticException, isUnhandledRejection); (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_3__/* .addExceptionMechanism */ .EG)(event, { synthetic: true, }); return event; } // If none of previous checks were valid, then it means that it's not: // - an instance of DOMError // - an instance of DOMException // - an instance of Event // - an instance of Error // - a valid ErrorEvent (one with an error property) // - a plain Object // // So bail out and capture it as a simple message: event = eventFromString(stackParser, exception , syntheticException, attachStacktrace); (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_3__/* .addExceptionTypeValue */ .Db)(event, `${exception}`, undefined); (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_3__/* .addExceptionMechanism */ .EG)(event, { synthetic: true, }); return event; } /** * @hidden */ function eventFromString( stackParser, input, syntheticException, attachStacktrace, ) { var event = { message: input, }; if (attachStacktrace && syntheticException) { var frames = parseStackFrames(stackParser, syntheticException); if (frames.length) { event.exception = { values: [{ value: input, stacktrace: { frames } }], }; } } return event; } //# sourceMappingURL=eventbuilder.js.map /***/ }), /***/ 86891: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Wz": function() { return /* binding */ shouldIgnoreOnError; }, /* harmony export */ "re": function() { return /* binding */ wrap; } /* harmony export */ }); /* unused harmony export ignoreNextOnError */ /* harmony import */ var _sentry_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(92876); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20535); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(62844); let ignoreOnError = 0; /** * @hidden */ function shouldIgnoreOnError() { return ignoreOnError > 0; } /** * @hidden */ function ignoreNextOnError() { // onerror should trigger before setTimeout ignoreOnError += 1; setTimeout(() => { ignoreOnError -= 1; }); } /** * Instruments the given function and sends an event to Sentry every time the * function throws an exception. * * @param fn A function to wrap. It is generally safe to pass an unbound function, because the returned wrapper always * has a correct `this` context. * @returns The wrapped function. * @hidden */ function wrap( fn, options = {}, before, ) { // for future readers what this does is wrap a function and then create // a bi-directional wrapping between them. // // example: wrapped = wrap(original); // original.__sentry_wrapped__ -> wrapped // wrapped.__sentry_original__ -> original if (typeof fn !== 'function') { return fn; } try { // if we're dealing with a function that was previously wrapped, return // the original wrapper. var wrapper = fn.__sentry_wrapped__; if (wrapper) { return wrapper; } // We don't wanna wrap it twice if ((0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__/* .getOriginalFunction */ .HK)(fn)) { return fn; } } catch (e) { // Just accessing custom props in some Selenium environments // can cause a "Permission denied" exception (see raven-js#495). // Bail on wrapping and return the function as-is (defers to window.onerror). return fn; } // It is important that `sentryWrapped` is not an arrow function to preserve the context of `this` var sentryWrapped = function () { var args = Array.prototype.slice.call(arguments); try { if (before && typeof before === 'function') { before.apply(this, arguments); } var wrappedArguments = args.map((arg) => wrap(arg, options)); // Attempt to invoke user-land function // NOTE: If you are a Sentry user, and you are seeing this stack frame, it // means the sentry.javascript SDK caught an error invoking your application code. This // is expected behavior and NOT indicative of a bug with sentry.javascript. return fn.apply(this, wrappedArguments); } catch (ex) { ignoreNextOnError(); (0,_sentry_core__WEBPACK_IMPORTED_MODULE_1__/* .withScope */ .$e)((scope) => { scope.addEventProcessor((event) => { if (options.mechanism) { (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_2__/* .addExceptionTypeValue */ .Db)(event, undefined, undefined); (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_2__/* .addExceptionMechanism */ .EG)(event, options.mechanism); } event.extra = { ...event.extra, arguments: args, }; return event; }); (0,_sentry_core__WEBPACK_IMPORTED_MODULE_1__/* .captureException */ .Tb)(ex); }); throw ex; } }; // Accessing some objects may throw // ref: https://github.com/getsentry/sentry-javascript/issues/1168 try { for (var property in fn) { if (Object.prototype.hasOwnProperty.call(fn, property)) { sentryWrapped[property] = fn[property]; } } } catch (_oO) {} // Signal that this function has been wrapped/filled already // for both debugging and to prevent it to being wrapped/filled twice (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__/* .markFunctionWrapped */ .$Q)(sentryWrapped, fn); (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__/* .addNonEnumerableProperty */ .xp)(fn, '__sentry_wrapped__', sentryWrapped); // Restore original function name (not all browsers allow that) try { var descriptor = Object.getOwnPropertyDescriptor(sentryWrapped, 'name') ; if (descriptor.configurable) { Object.defineProperty(sentryWrapped, 'name', { get() { return fn.name; }, }); } } catch (_oO) {} return sentryWrapped; } /** * All properties the report dialog supports */ //# sourceMappingURL=helpers.js.map /***/ }), /***/ 71861: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { "p": function() { return /* binding */ BREADCRUMB_INTEGRATION_ID; }, "O": function() { return /* binding */ Breadcrumbs; } }); // EXTERNAL MODULE: ./node_modules/@sentry/hub/esm/hub.js var hub = __webpack_require__(38641); // EXTERNAL MODULE: ./node_modules/@sentry/utils/esm/instrument.js var instrument = __webpack_require__(9732); // EXTERNAL MODULE: ./node_modules/@sentry/utils/esm/browser.js var browser = __webpack_require__(58464); ;// CONCATENATED MODULE: ./node_modules/@sentry/utils/esm/severity.js // Note: Ideally the `SeverityLevel` type would be derived from `validSeverityLevels`, but that would mean either // // a) moving `validSeverityLevels` to `@sentry/types`, // b) moving the`SeverityLevel` type here, or // c) importing `validSeverityLevels` from here into `@sentry/types`. // // Option A would make `@sentry/types` a runtime dependency of `@sentry/utils` (not good), and options B and C would // create a circular dependency between `@sentry/types` and `@sentry/utils` (also not good). So a TODO accompanying the // type, reminding anyone who changes it to change this list also, will have to do. var validSeverityLevels = ['fatal', 'error', 'warning', 'log', 'info', 'debug']; /** * Converts a string-based level into a member of the deprecated {@link Severity} enum. * * @deprecated `severityFromString` is deprecated. Please use `severityLevelFromString` instead. * * @param level String representation of Severity * @returns Severity */ function severityFromString(level) { return severityLevelFromString(level) ; } /** * Converts a string-based level into a `SeverityLevel`, normalizing it along the way. * * @param level String representation of desired `SeverityLevel`. * @returns The `SeverityLevel` corresponding to the given string, or 'log' if the string isn't a valid level. */ function severityLevelFromString(level) { return (level === 'warn' ? 'warning' : validSeverityLevels.includes(level) ? level : 'log') ; } //# sourceMappingURL=severity.js.map // EXTERNAL MODULE: ./node_modules/@sentry/utils/esm/string.js var string = __webpack_require__(57321); // EXTERNAL MODULE: ./node_modules/@sentry/utils/esm/global.js var esm_global = __webpack_require__(82991); // EXTERNAL MODULE: ./node_modules/@sentry/utils/esm/url.js var url = __webpack_require__(26956); ;// CONCATENATED MODULE: ./node_modules/@sentry/browser/esm/integrations/breadcrumbs.js /** JSDoc */ var BREADCRUMB_INTEGRATION_ID = 'Breadcrumbs'; /** * Default Breadcrumbs instrumentations * TODO: Deprecated - with v6, this will be renamed to `Instrument` */ class Breadcrumbs { /** * @inheritDoc */ static __initStatic() {this.id = BREADCRUMB_INTEGRATION_ID;} /** * @inheritDoc */ __init() {this.name = Breadcrumbs.id;} /** * Options of the breadcrumbs integration. */ // This field is public, because we use it in the browser client to check if the `sentry` option is enabled. /** * @inheritDoc */ constructor(options) {;Breadcrumbs.prototype.__init.call(this); this.options = { console: true, dom: true, fetch: true, history: true, sentry: true, xhr: true, ...options, }; } /** * Instrument browser built-ins w/ breadcrumb capturing * - Console API * - DOM API (click/typing) * - XMLHttpRequest API * - Fetch API * - History API */ setupOnce() { if (this.options.console) { (0,instrument/* addInstrumentationHandler */.o)('console', _consoleBreadcrumb); } if (this.options.dom) { (0,instrument/* addInstrumentationHandler */.o)('dom', _domBreadcrumb(this.options.dom)); } if (this.options.xhr) { (0,instrument/* addInstrumentationHandler */.o)('xhr', _xhrBreadcrumb); } if (this.options.fetch) { (0,instrument/* addInstrumentationHandler */.o)('fetch', _fetchBreadcrumb); } if (this.options.history) { (0,instrument/* addInstrumentationHandler */.o)('history', _historyBreadcrumb); } } } Breadcrumbs.__initStatic(); /** * A HOC that creaes a function that creates breadcrumbs from DOM API calls. * This is a HOC so that we get access to dom options in the closure. */ function _domBreadcrumb(dom) { function _innerDomBreadcrumb(handlerData) { let target; let keyAttrs = typeof dom === 'object' ? dom.serializeAttribute : undefined; if (typeof keyAttrs === 'string') { keyAttrs = [keyAttrs]; } // Accessing event.target can throw (see getsentry/raven-js#838, #768) try { target = handlerData.event.target ? (0,browser/* htmlTreeAsString */.R)(handlerData.event.target , keyAttrs) : (0,browser/* htmlTreeAsString */.R)(handlerData.event , keyAttrs); } catch (e) { target = ''; } if (target.length === 0) { return; } (0,hub/* getCurrentHub */.Gd)().addBreadcrumb( { category: `ui.${handlerData.name}`, message: target, }, { event: handlerData.event, name: handlerData.name, global: handlerData.global, }, ); } return _innerDomBreadcrumb; } /** * Creates breadcrumbs from console API calls */ function _consoleBreadcrumb(handlerData) { var breadcrumb = { category: 'console', data: { arguments: handlerData.args, logger: 'console', }, level: severityLevelFromString(handlerData.level), message: (0,string/* safeJoin */.nK)(handlerData.args, ' '), }; if (handlerData.level === 'assert') { if (handlerData.args[0] === false) { breadcrumb.message = `Assertion failed: ${(0,string/* safeJoin */.nK)(handlerData.args.slice(1), ' ') || 'console.assert'}`; breadcrumb.data.arguments = handlerData.args.slice(1); } else { // Don't capture a breadcrumb for passed assertions return; } } (0,hub/* getCurrentHub */.Gd)().addBreadcrumb(breadcrumb, { input: handlerData.args, level: handlerData.level, }); } /** * Creates breadcrumbs from XHR API calls */ function _xhrBreadcrumb(handlerData) { if (handlerData.endTimestamp) { // We only capture complete, non-sentry requests if (handlerData.xhr.__sentry_own_request__) { return; } const { method, url, status_code, body } = handlerData.xhr.__sentry_xhr__ || {}; (0,hub/* getCurrentHub */.Gd)().addBreadcrumb( { category: 'xhr', data: { method, url, status_code, }, type: 'http', }, { xhr: handlerData.xhr, input: body, }, ); return; } } /** * Creates breadcrumbs from fetch API calls */ function _fetchBreadcrumb(handlerData) { // We only capture complete fetch requests if (!handlerData.endTimestamp) { return; } if (handlerData.fetchData.url.match(/sentry_key/) && handlerData.fetchData.method === 'POST') { // We will not create breadcrumbs for fetch requests that contain `sentry_key` (internal sentry requests) return; } if (handlerData.error) { (0,hub/* getCurrentHub */.Gd)().addBreadcrumb( { category: 'fetch', data: handlerData.fetchData, level: 'error', type: 'http', }, { data: handlerData.error, input: handlerData.args, }, ); } else { (0,hub/* getCurrentHub */.Gd)().addBreadcrumb( { category: 'fetch', data: { ...handlerData.fetchData, status_code: handlerData.response.status, }, type: 'http', }, { input: handlerData.args, response: handlerData.response, }, ); } } /** * Creates breadcrumbs from history API calls */ function _historyBreadcrumb(handlerData) { var global = (0,esm_global/* getGlobalObject */.R)(); let from = handlerData.from; let to = handlerData.to; var parsedLoc = (0,url/* parseUrl */.en)(global.location.href); let parsedFrom = (0,url/* parseUrl */.en)(from); var parsedTo = (0,url/* parseUrl */.en)(to); // Initial pushState doesn't provide `from` information if (!parsedFrom.path) { parsedFrom = parsedLoc; } // Use only the path component of the URL if the URL matches the current // document (almost all the time when using pushState) if (parsedLoc.protocol === parsedTo.protocol && parsedLoc.host === parsedTo.host) { to = parsedTo.relative; } if (parsedLoc.protocol === parsedFrom.protocol && parsedLoc.host === parsedFrom.host) { from = parsedFrom.relative; } (0,hub/* getCurrentHub */.Gd)().addBreadcrumb({ category: 'navigation', data: { from, to, }, }); } //# sourceMappingURL=breadcrumbs.js.map /***/ }), /***/ 69730: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "I": function() { return /* binding */ Dedupe; } /* harmony export */ }); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(12343); /** Deduplication filter */ class Dedupe {constructor() { Dedupe.prototype.__init.call(this); } /** * @inheritDoc */ static __initStatic() {this.id = 'Dedupe';} /** * @inheritDoc */ __init() {this.name = Dedupe.id;} /** * @inheritDoc */ /** * @inheritDoc */ setupOnce(addGlobalEventProcessor, getCurrentHub) { var eventProcessor = currentEvent => { var self = getCurrentHub().getIntegration(Dedupe); if (self) { // Juuust in case something goes wrong try { if (_shouldDropEvent(currentEvent, self._previousEvent)) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_0__/* .logger.warn */ .kg.warn('Event dropped due to being a duplicate of previously captured event.'); return null; } } catch (_oO) { return (self._previousEvent = currentEvent); } return (self._previousEvent = currentEvent); } return currentEvent; }; eventProcessor.id = this.name; addGlobalEventProcessor(eventProcessor); } } Dedupe.__initStatic(); /** JSDoc */ function _shouldDropEvent(currentEvent, previousEvent) { if (!previousEvent) { return false; } if (_isSameMessageEvent(currentEvent, previousEvent)) { return true; } if (_isSameExceptionEvent(currentEvent, previousEvent)) { return true; } return false; } /** JSDoc */ function _isSameMessageEvent(currentEvent, previousEvent) { var currentMessage = currentEvent.message; var previousMessage = previousEvent.message; // If neither event has a message property, they were both exceptions, so bail out if (!currentMessage && !previousMessage) { return false; } // If only one event has a stacktrace, but not the other one, they are not the same if ((currentMessage && !previousMessage) || (!currentMessage && previousMessage)) { return false; } if (currentMessage !== previousMessage) { return false; } if (!_isSameFingerprint(currentEvent, previousEvent)) { return false; } if (!_isSameStacktrace(currentEvent, previousEvent)) { return false; } return true; } /** JSDoc */ function _isSameExceptionEvent(currentEvent, previousEvent) { var previousException = _getExceptionFromEvent(previousEvent); var currentException = _getExceptionFromEvent(currentEvent); if (!previousException || !currentException) { return false; } if (previousException.type !== currentException.type || previousException.value !== currentException.value) { return false; } if (!_isSameFingerprint(currentEvent, previousEvent)) { return false; } if (!_isSameStacktrace(currentEvent, previousEvent)) { return false; } return true; } /** JSDoc */ function _isSameStacktrace(currentEvent, previousEvent) { let currentFrames = _getFramesFromEvent(currentEvent); let previousFrames = _getFramesFromEvent(previousEvent); // If neither event has a stacktrace, they are assumed to be the same if (!currentFrames && !previousFrames) { return true; } // If only one event has a stacktrace, but not the other one, they are not the same if ((currentFrames && !previousFrames) || (!currentFrames && previousFrames)) { return false; } currentFrames = currentFrames ; previousFrames = previousFrames ; // If number of frames differ, they are not the same if (previousFrames.length !== currentFrames.length) { return false; } // Otherwise, compare the two for (let i = 0; i < previousFrames.length; i++) { var frameA = previousFrames[i]; var frameB = currentFrames[i]; if ( frameA.filename !== frameB.filename || frameA.lineno !== frameB.lineno || frameA.colno !== frameB.colno || frameA.function !== frameB.function ) { return false; } } return true; } /** JSDoc */ function _isSameFingerprint(currentEvent, previousEvent) { let currentFingerprint = currentEvent.fingerprint; let previousFingerprint = previousEvent.fingerprint; // If neither event has a fingerprint, they are assumed to be the same if (!currentFingerprint && !previousFingerprint) { return true; } // If only one event has a fingerprint, but not the other one, they are not the same if ((currentFingerprint && !previousFingerprint) || (!currentFingerprint && previousFingerprint)) { return false; } currentFingerprint = currentFingerprint ; previousFingerprint = previousFingerprint ; // Otherwise, compare the two try { return !!(currentFingerprint.join('') === previousFingerprint.join('')); } catch (_oO) { return false; } } /** JSDoc */ function _getExceptionFromEvent(event) { return event.exception && event.exception.values && event.exception.values[0]; } /** JSDoc */ function _getFramesFromEvent(event) { var exception = event.exception; if (exception) { try { // @ts-ignore Object could be undefined return exception.values[0].stacktrace.frames; } catch (_oO) { return undefined; } } return undefined; } //# sourceMappingURL=dedupe.js.map /***/ }), /***/ 52136: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "d": function() { return /* binding */ GlobalHandlers; } /* harmony export */ }); /* harmony import */ var _sentry_core__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(38641); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9732); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(67597); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(58464); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(12343); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(62844); /* harmony import */ var _eventbuilder_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84773); /* harmony import */ var _helpers_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(86891); /** Global handlers */ class GlobalHandlers { /** * @inheritDoc */ static __initStatic() {this.id = 'GlobalHandlers';} /** * @inheritDoc */ __init() {this.name = GlobalHandlers.id;} /** JSDoc */ /** * Stores references functions to installing handlers. Will set to undefined * after they have been run so that they are not used twice. */ __init2() {this._installFunc = { onerror: _installGlobalOnErrorHandler, onunhandledrejection: _installGlobalOnUnhandledRejectionHandler, };} /** JSDoc */ constructor(options) {;GlobalHandlers.prototype.__init.call(this);GlobalHandlers.prototype.__init2.call(this); this._options = { onerror: true, onunhandledrejection: true, ...options, }; } /** * @inheritDoc */ setupOnce() { Error.stackTraceLimit = 50; var options = this._options; // We can disable guard-for-in as we construct the options object above + do checks against // `this._installFunc` for the property. for (var key in options) { var installFunc = this._installFunc[key ]; if (installFunc && options[key ]) { globalHandlerLog(key); installFunc(); this._installFunc[key ] = undefined; } } } } GlobalHandlers.__initStatic(); /** JSDoc */ function _installGlobalOnErrorHandler() { (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__/* .addInstrumentationHandler */ .o)( 'error', (data) => { const [hub, stackParser, attachStacktrace] = getHubAndOptions(); if (!hub.getIntegration(GlobalHandlers)) { return; } const { msg, url, line, column, error } = data; if ((0,_helpers_js__WEBPACK_IMPORTED_MODULE_1__/* .shouldIgnoreOnError */ .Wz)() || (error && error.__sentry_own_request__)) { return; } var event = error === undefined && (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_2__/* .isString */ .HD)(msg) ? _eventFromIncompleteOnError(msg, url, line, column) : _enhanceEventWithInitialFrame( (0,_eventbuilder_js__WEBPACK_IMPORTED_MODULE_3__/* .eventFromUnknownInput */ .ME)(stackParser, error || msg, undefined, attachStacktrace, false), url, line, column, ); event.level = 'error'; addMechanismAndCapture(hub, error, event, 'onerror'); }, ); } /** JSDoc */ function _installGlobalOnUnhandledRejectionHandler() { (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__/* .addInstrumentationHandler */ .o)( 'unhandledrejection', (e) => { const [hub, stackParser, attachStacktrace] = getHubAndOptions(); if (!hub.getIntegration(GlobalHandlers)) { return; } let error = e; // dig the object of the rejection out of known event types try { // PromiseRejectionEvents store the object of the rejection under 'reason' // see https://developer.mozilla.org/en-US/docs/Web/API/PromiseRejectionEvent if ('reason' in e) { error = e.reason; } // something, somewhere, (likely a browser extension) effectively casts PromiseRejectionEvents // to CustomEvents, moving the `promise` and `reason` attributes of the PRE into // the CustomEvent's `detail` attribute, since they're not part of CustomEvent's spec // see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent and // https://github.com/getsentry/sentry-javascript/issues/2380 else if ('detail' in e && 'reason' in e.detail) { error = e.detail.reason; } } catch (_oO) { // no-empty } if ((0,_helpers_js__WEBPACK_IMPORTED_MODULE_1__/* .shouldIgnoreOnError */ .Wz)() || (error && error.__sentry_own_request__)) { return true; } var event = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_2__/* .isPrimitive */ .pt)(error) ? _eventFromRejectionWithPrimitive(error) : (0,_eventbuilder_js__WEBPACK_IMPORTED_MODULE_3__/* .eventFromUnknownInput */ .ME)(stackParser, error, undefined, attachStacktrace, true); event.level = 'error'; addMechanismAndCapture(hub, error, event, 'onunhandledrejection'); return; }, ); } /** * Create an event from a promise rejection where the `reason` is a primitive. * * @param reason: The `reason` property of the promise rejection * @returns An Event object with an appropriate `exception` value */ function _eventFromRejectionWithPrimitive(reason) { return { exception: { values: [ { type: 'UnhandledRejection', // String() is needed because the Primitive type includes symbols (which can't be automatically stringified) value: `Non-Error promise rejection captured with value: ${String(reason)}`, }, ], }, }; } /** * This function creates a stack from an old, error-less onerror handler. */ function _eventFromIncompleteOnError(msg, url, line, column) { var ERROR_TYPES_RE = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i; // If 'message' is ErrorEvent, get real message from inside let message = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_2__/* .isErrorEvent */ .VW)(msg) ? msg.message : msg; let name = 'Error'; var groups = message.match(ERROR_TYPES_RE); if (groups) { name = groups[1]; message = groups[2]; } var event = { exception: { values: [ { type: name, value: message, }, ], }, }; return _enhanceEventWithInitialFrame(event, url, line, column); } /** JSDoc */ function _enhanceEventWithInitialFrame(event, url, line, column) { // event.exception var e = (event.exception = event.exception || {}); // event.exception.values var ev = (e.values = e.values || []); // event.exception.values[0] var ev0 = (ev[0] = ev[0] || {}); // event.exception.values[0].stacktrace var ev0s = (ev0.stacktrace = ev0.stacktrace || {}); // event.exception.values[0].stacktrace.frames var ev0sf = (ev0s.frames = ev0s.frames || []); var colno = isNaN(parseInt(column, 10)) ? undefined : column; var lineno = isNaN(parseInt(line, 10)) ? undefined : line; var filename = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_2__/* .isString */ .HD)(url) && url.length > 0 ? url : (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_4__/* .getLocationHref */ .l)(); // event.exception.values[0].stacktrace.frames if (ev0sf.length === 0) { ev0sf.push({ colno, filename, function: '?', in_app: true, lineno, }); } return event; } function globalHandlerLog(type) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_5__/* .logger.log */ .kg.log(`Global Handler attached: ${type}`); } function addMechanismAndCapture(hub, error, event, type) { (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_6__/* .addExceptionMechanism */ .EG)(event, { handled: false, type, }); hub.captureEvent(event, { originalException: error, }); } function getHubAndOptions() { var hub = (0,_sentry_core__WEBPACK_IMPORTED_MODULE_7__/* .getCurrentHub */ .Gd)(); var client = hub.getClient(); var options = (client && client.getOptions()) || { stackParser: () => [], attachStacktrace: false, }; return [hub, options.stackParser, options.attachStacktrace]; } //# sourceMappingURL=globalhandlers.js.map /***/ }), /***/ 61945: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "q": function() { return /* binding */ HttpContext; } /* harmony export */ }); /* harmony import */ var _sentry_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(46769); /* harmony import */ var _sentry_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(38641); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(82991); var global = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__/* .getGlobalObject */ .R)(); /** HttpContext integration collects information about HTTP request headers */ class HttpContext {constructor() { HttpContext.prototype.__init.call(this); } /** * @inheritDoc */ static __initStatic() {this.id = 'HttpContext';} /** * @inheritDoc */ __init() {this.name = HttpContext.id;} /** * @inheritDoc */ setupOnce() { (0,_sentry_core__WEBPACK_IMPORTED_MODULE_1__/* .addGlobalEventProcessor */ .c)((event) => { if ((0,_sentry_core__WEBPACK_IMPORTED_MODULE_2__/* .getCurrentHub */ .Gd)().getIntegration(HttpContext)) { // if none of the information we want exists, don't bother if (!global.navigator && !global.location && !global.document) { return event; } // grab as much info as exists and add it to the event var url = (event.request && event.request.url) || (global.location && global.location.href); const { referrer } = global.document || {}; const { userAgent } = global.navigator || {}; var headers = { ...(event.request && event.request.headers), ...(referrer && { Referer: referrer }), ...(userAgent && { 'User-Agent': userAgent }), }; var request = { ...(url && { url }), headers }; return { ...event, request }; } return event; }); } } HttpContext.__initStatic(); //# sourceMappingURL=httpcontext.js.map /***/ }), /***/ 61634: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "iP": function() { return /* binding */ LinkedErrors; } /* harmony export */ }); /* unused harmony exports _handler, _walkErrorTree */ /* harmony import */ var _sentry_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(38641); /* harmony import */ var _sentry_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(46769); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(67597); /* harmony import */ var _eventbuilder_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84773); var DEFAULT_KEY = 'cause'; var DEFAULT_LIMIT = 5; /** Adds SDK info to an event. */ class LinkedErrors { /** * @inheritDoc */ static __initStatic() {this.id = 'LinkedErrors';} /** * @inheritDoc */ __init() {this.name = LinkedErrors.id;} /** * @inheritDoc */ /** * @inheritDoc */ /** * @inheritDoc */ constructor(options = {}) {;LinkedErrors.prototype.__init.call(this); this._key = options.key || DEFAULT_KEY; this._limit = options.limit || DEFAULT_LIMIT; } /** * @inheritDoc */ setupOnce() { var client = (0,_sentry_core__WEBPACK_IMPORTED_MODULE_0__/* .getCurrentHub */ .Gd)().getClient(); if (!client) { return; } (0,_sentry_core__WEBPACK_IMPORTED_MODULE_1__/* .addGlobalEventProcessor */ .c)((event, hint) => { var self = (0,_sentry_core__WEBPACK_IMPORTED_MODULE_0__/* .getCurrentHub */ .Gd)().getIntegration(LinkedErrors); return self ? _handler(client.getOptions().stackParser, self._key, self._limit, event, hint) : event; }); } } LinkedErrors.__initStatic(); /** * @inheritDoc */ function _handler( parser, key, limit, event, hint, ) { if (!event.exception || !event.exception.values || !hint || !(0,_sentry_utils__WEBPACK_IMPORTED_MODULE_2__/* .isInstanceOf */ .V9)(hint.originalException, Error)) { return event; } var linkedErrors = _walkErrorTree(parser, limit, hint.originalException , key); event.exception.values = [...linkedErrors, ...event.exception.values]; return event; } /** * JSDOC */ function _walkErrorTree( parser, limit, error, key, stack = [], ) { if (!(0,_sentry_utils__WEBPACK_IMPORTED_MODULE_2__/* .isInstanceOf */ .V9)(error[key], Error) || stack.length + 1 >= limit) { return stack; } var exception = (0,_eventbuilder_js__WEBPACK_IMPORTED_MODULE_3__/* .exceptionFromError */ .GJ)(parser, error[key]); return _walkErrorTree(parser, limit, error[key], key, [exception, ...stack]); } //# sourceMappingURL=linkederrors.js.map /***/ }), /***/ 53692: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "p": function() { return /* binding */ TryCatch; } /* harmony export */ }); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(82991); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(20535); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(30360); /* harmony import */ var _helpers_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(86891); var DEFAULT_EVENT_TARGET = [ 'EventTarget', 'Window', 'Node', 'ApplicationCache', 'AudioTrackList', 'ChannelMergerNode', 'CryptoOperation', 'EventSource', 'FileReader', 'HTMLUnknownElement', 'IDBDatabase', 'IDBRequest', 'IDBTransaction', 'KeyOperation', 'MediaController', 'MessagePort', 'ModalWindow', 'Notification', 'SVGElementInstance', 'Screen', 'TextTrack', 'TextTrackCue', 'TextTrackList', 'WebSocket', 'WebSocketWorker', 'Worker', 'XMLHttpRequest', 'XMLHttpRequestEventTarget', 'XMLHttpRequestUpload', ]; /** Wrap timer functions and event targets to catch errors and provide better meta data */ class TryCatch { /** * @inheritDoc */ static __initStatic() {this.id = 'TryCatch';} /** * @inheritDoc */ __init() {this.name = TryCatch.id;} /** JSDoc */ /** * @inheritDoc */ constructor(options) {;TryCatch.prototype.__init.call(this); this._options = { XMLHttpRequest: true, eventTarget: true, requestAnimationFrame: true, setInterval: true, setTimeout: true, ...options, }; } /** * Wrap timer functions and event targets to catch errors * and provide better metadata. */ setupOnce() { var global = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__/* .getGlobalObject */ .R)(); if (this._options.setTimeout) { (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__/* .fill */ .hl)(global, 'setTimeout', _wrapTimeFunction); } if (this._options.setInterval) { (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__/* .fill */ .hl)(global, 'setInterval', _wrapTimeFunction); } if (this._options.requestAnimationFrame) { (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__/* .fill */ .hl)(global, 'requestAnimationFrame', _wrapRAF); } if (this._options.XMLHttpRequest && 'XMLHttpRequest' in global) { (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__/* .fill */ .hl)(XMLHttpRequest.prototype, 'send', _wrapXHR); } var eventTargetOption = this._options.eventTarget; if (eventTargetOption) { var eventTarget = Array.isArray(eventTargetOption) ? eventTargetOption : DEFAULT_EVENT_TARGET; eventTarget.forEach(_wrapEventTarget); } } } TryCatch.__initStatic(); /** JSDoc */ function _wrapTimeFunction(original) { return function ( ...args) { var originalCallback = args[0]; args[0] = (0,_helpers_js__WEBPACK_IMPORTED_MODULE_2__/* .wrap */ .re)(originalCallback, { mechanism: { data: { function: (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_3__/* .getFunctionName */ .$P)(original) }, handled: true, type: 'instrument', }, }); return original.apply(this, args); }; } /** JSDoc */ function _wrapRAF(original) { return function ( callback) { return original.apply(this, [ (0,_helpers_js__WEBPACK_IMPORTED_MODULE_2__/* .wrap */ .re)(callback, { mechanism: { data: { function: 'requestAnimationFrame', handler: (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_3__/* .getFunctionName */ .$P)(original), }, handled: true, type: 'instrument', }, }), ]); }; } /** JSDoc */ function _wrapXHR(originalSend) { return function ( ...args) { var xhr = this; var xmlHttpRequestProps = ['onload', 'onerror', 'onprogress', 'onreadystatechange']; xmlHttpRequestProps.forEach(prop => { if (prop in xhr && typeof xhr[prop] === 'function') { (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__/* .fill */ .hl)(xhr, prop, function (original) { var wrapOptions = { mechanism: { data: { function: prop, handler: (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_3__/* .getFunctionName */ .$P)(original), }, handled: true, type: 'instrument', }, }; // If Instrument integration has been called before TryCatch, get the name of original function var originalFunction = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__/* .getOriginalFunction */ .HK)(original); if (originalFunction) { wrapOptions.mechanism.data.handler = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_3__/* .getFunctionName */ .$P)(originalFunction); } // Otherwise wrap directly return (0,_helpers_js__WEBPACK_IMPORTED_MODULE_2__/* .wrap */ .re)(original, wrapOptions); }); } }); return originalSend.apply(this, args); }; } /** JSDoc */ function _wrapEventTarget(target) { var global = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__/* .getGlobalObject */ .R)() ; var proto = global[target] && global[target].prototype; if (!proto || !proto.hasOwnProperty || !proto.hasOwnProperty('addEventListener')) { return; } (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__/* .fill */ .hl)(proto, 'addEventListener', function (original) { return function ( eventName, fn, options, ) { try { if (typeof fn.handleEvent === 'function') { // ESlint disable explanation: // First, it is generally safe to call `wrap` with an unbound function. Furthermore, using `.bind()` would // introduce a bug here, because bind returns a new function that doesn't have our // flags(like __sentry_original__) attached. `wrap` checks for those flags to avoid unnecessary wrapping. // Without those flags, every call to addEventListener wraps the function again, causing a memory leak. fn.handleEvent = (0,_helpers_js__WEBPACK_IMPORTED_MODULE_2__/* .wrap */ .re)(fn.handleEvent, { mechanism: { data: { function: 'handleEvent', handler: (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_3__/* .getFunctionName */ .$P)(fn), target, }, handled: true, type: 'instrument', }, }); } } catch (err) { // can sometimes get 'Permission denied to access property "handle Event' } return original.apply(this, [ eventName, (0,_helpers_js__WEBPACK_IMPORTED_MODULE_2__/* .wrap */ .re)(fn , { mechanism: { data: { function: 'addEventListener', handler: (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_3__/* .getFunctionName */ .$P)(fn), target, }, handled: true, type: 'instrument', }, }), options, ]); }; }); (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__/* .fill */ .hl)( proto, 'removeEventListener', function ( originalRemoveEventListener, ) { return function ( eventName, fn, options, ) { /** * There are 2 possible scenarios here: * * 1. Someone passes a callback, which was attached prior to Sentry initialization, or by using unmodified * method, eg. `document.addEventListener.call(el, name, handler). In this case, we treat this function * as a pass-through, and call original `removeEventListener` with it. * * 2. Someone passes a callback, which was attached after Sentry was initialized, which means that it was using * our wrapped version of `addEventListener`, which internally calls `wrap` helper. * This helper "wraps" whole callback inside a try/catch statement, and attached appropriate metadata to it, * in order for us to make a distinction between wrapped/non-wrapped functions possible. * If a function was wrapped, it has additional property of `__sentry_wrapped__`, holding the handler. * * When someone adds a handler prior to initialization, and then do it again, but after, * then we have to detach both of them. Otherwise, if we'd detach only wrapped one, it'd be impossible * to get rid of the initial handler and it'd stick there forever. */ var wrappedEventHandler = fn ; try { var originalEventHandler = wrappedEventHandler && wrappedEventHandler.__sentry_wrapped__; if (originalEventHandler) { originalRemoveEventListener.call(this, eventName, originalEventHandler, options); } } catch (e) { // ignore, accessing __sentry_wrapped__ will throw in some Selenium environments } return originalRemoveEventListener.call(this, eventName, wrappedEventHandler, options); }; }, ); } //# sourceMappingURL=trycatch.js.map /***/ }), /***/ 8403: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { "S1": function() { return /* binding */ init; }, "jp": function() { return /* binding */ showReportDialog; } }); // UNUSED EXPORTS: close, defaultIntegrations, flush, forceLoad, lastEventId, onLoad, wrap // EXTERNAL MODULE: ./node_modules/@sentry/core/esm/integrations/inboundfilters.js var inboundfilters = __webpack_require__(42422); // EXTERNAL MODULE: ./node_modules/@sentry/core/esm/integrations/functiontostring.js var functiontostring = __webpack_require__(19116); // EXTERNAL MODULE: ./node_modules/@sentry/hub/esm/scope.js var esm_scope = __webpack_require__(46769); // EXTERNAL MODULE: ./node_modules/@sentry/hub/esm/hub.js var esm_hub = __webpack_require__(38641); // EXTERNAL MODULE: ./node_modules/@sentry/utils/esm/logger.js var esm_logger = __webpack_require__(12343); ;// CONCATENATED MODULE: ./node_modules/@sentry/core/esm/integration.js var installedIntegrations = []; /** Map of integrations assigned to a client */ /** * @private */ function filterDuplicates(integrations) { return integrations.reduce((acc, integrations) => { if (acc.every(accIntegration => integrations.name !== accIntegration.name)) { acc.push(integrations); } return acc; }, [] ); } /** Gets integration to install */ function getIntegrationsToSetup(options) { var defaultIntegrations = (options.defaultIntegrations && [...options.defaultIntegrations]) || []; var userIntegrations = options.integrations; let integrations = [...filterDuplicates(defaultIntegrations)]; if (Array.isArray(userIntegrations)) { // Filter out integrations that are also included in user options integrations = [ ...integrations.filter(integrations => userIntegrations.every(userIntegration => userIntegration.name !== integrations.name), ), // And filter out duplicated user options integrations ...filterDuplicates(userIntegrations), ]; } else if (typeof userIntegrations === 'function') { integrations = userIntegrations(integrations); integrations = Array.isArray(integrations) ? integrations : [integrations]; } // Make sure that if present, `Debug` integration will always run last var integrationsNames = integrations.map(i => i.name); var alwaysLastToRun = 'Debug'; if (integrationsNames.indexOf(alwaysLastToRun) !== -1) { integrations.push(...integrations.splice(integrationsNames.indexOf(alwaysLastToRun), 1)); } return integrations; } /** * Given a list of integration instances this installs them all. When `withDefaults` is set to `true` then all default * integrations are added unless they were already provided before. * @param integrations array of integration instances * @param withDefault should enable default integrations */ function setupIntegrations(integrations) { var integrationIndex = {}; integrations.forEach(integration => { integrationIndex[integration.name] = integration; if (installedIntegrations.indexOf(integration.name) === -1) { integration.setupOnce(esm_scope/* addGlobalEventProcessor */.c, esm_hub/* getCurrentHub */.Gd); installedIntegrations.push(integration.name); (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && esm_logger/* logger.log */.kg.log(`Integration installed: ${integration.name}`); } }); return integrationIndex; } //# sourceMappingURL=integration.js.map ;// CONCATENATED MODULE: ./node_modules/@sentry/core/esm/sdk.js /** A class object that can instantiate Client objects. */ /** * Internal function to create a new SDK client instance. The client is * installed and then bound to the current scope. * * @param clientClass The client class to instantiate. * @param options Options to pass to the client. */ function initAndBind( clientClass, options, ) { if (options.debug === true) { if ((typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__)) { esm_logger/* logger.enable */.kg.enable(); } else { // use `console.warn` rather than `logger.warn` since by non-debug bundles have all `logger.x` statements stripped console.warn('[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.'); } } var hub = (0,esm_hub/* getCurrentHub */.Gd)(); var scope = hub.getScope(); if (scope) { scope.update(options.initialScope); } var client = new clientClass(options); hub.bindClient(client); } //# sourceMappingURL=sdk.js.map // EXTERNAL MODULE: ./node_modules/@sentry/utils/esm/object.js var object = __webpack_require__(20535); ;// CONCATENATED MODULE: ./node_modules/@sentry/utils/esm/error.js /** An error emitted by Sentry SDKs and related utilities. */ class SentryError extends Error { /** Display name of this error instance. */ constructor( message, logLevel = 'warn') { super(message);this.message = message;; this.name = new.target.prototype.constructor.name; // This sets the prototype to be `Error`, not `SentryError`. It's unclear why we do this, but commenting this line // out causes various (seemingly totally unrelated) playwright tests consistently time out. FYI, this makes // instances of `SentryError` fail `obj instanceof SentryError` checks. Object.setPrototypeOf(this, new.target.prototype); this.logLevel = logLevel; } } //# sourceMappingURL=error.js.map ;// CONCATENATED MODULE: ./node_modules/@sentry/utils/esm/dsn.js /** Regular expression used to parse a Dsn. */ var DSN_REGEX = /^(?:(\w+):)\/\/(?:(\w+)(?::(\w+))?@)([\w.-]+)(?::(\d+))?\/(.+)/; function isValidProtocol(protocol) { return protocol === 'http' || protocol === 'https'; } /** * Renders the string representation of this Dsn. * * By default, this will render the public representation without the password * component. To get the deprecated private representation, set `withPassword` * to true. * * @param withPassword When set to true, the password will be included. */ function dsnToString(dsn, withPassword = false) { const { host, path, pass, port, projectId, protocol, publicKey } = dsn; return ( `${protocol}://${publicKey}${withPassword && pass ? `:${pass}` : ''}` + `@${host}${port ? `:${port}` : ''}/${path ? `${path}/` : path}${projectId}` ); } /** * Parses a Dsn from a given string. * * @param str A Dsn as string * @returns Dsn as DsnComponents */ function dsnFromString(str) { var match = DSN_REGEX.exec(str); if (!match) { throw new SentryError(`Invalid Sentry Dsn: ${str}`); } const [protocol, publicKey, pass = '', host, port = '', lastPath] = match.slice(1); let path = ''; let projectId = lastPath; var split = projectId.split('/'); if (split.length > 1) { path = split.slice(0, -1).join('/'); projectId = split.pop() ; } if (projectId) { var projectMatch = projectId.match(/^\d+/); if (projectMatch) { projectId = projectMatch[0]; } } return dsnFromComponents({ host, pass, path, projectId, port, protocol: protocol , publicKey }); } function dsnFromComponents(components) { return { protocol: components.protocol, publicKey: components.publicKey || '', pass: components.pass || '', host: components.host, port: components.port || '', path: components.path || '', projectId: components.projectId, }; } function validateDsn(dsn) { if (!(typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__)) { return; } const { port, projectId, protocol } = dsn; var requiredComponents = ['protocol', 'publicKey', 'host', 'projectId']; requiredComponents.forEach(component => { if (!dsn[component]) { throw new SentryError(`Invalid Sentry Dsn: ${component} missing`); } }); if (!projectId.match(/^\d+$/)) { throw new SentryError(`Invalid Sentry Dsn: Invalid projectId ${projectId}`); } if (!isValidProtocol(protocol)) { throw new SentryError(`Invalid Sentry Dsn: Invalid protocol ${protocol}`); } if (port && isNaN(parseInt(port, 10))) { throw new SentryError(`Invalid Sentry Dsn: Invalid port ${port}`); } return true; } /** The Sentry Dsn, identifying a Sentry instance and project. */ function makeDsn(from) { var components = typeof from === 'string' ? dsnFromString(from) : dsnFromComponents(from); validateDsn(components); return components; } //# sourceMappingURL=dsn.js.map ;// CONCATENATED MODULE: ./node_modules/@sentry/core/esm/api.js var SENTRY_API_VERSION = '7'; /** Returns the prefix to construct Sentry ingestion API endpoints. */ function getBaseApiEndpoint(dsn) { var protocol = dsn.protocol ? `${dsn.protocol}:` : ''; var port = dsn.port ? `:${dsn.port}` : ''; return `${protocol}//${dsn.host}${port}${dsn.path ? `/${dsn.path}` : ''}/api/`; } /** Returns the ingest API endpoint for target. */ function _getIngestEndpoint(dsn) { return `${getBaseApiEndpoint(dsn)}${dsn.projectId}/envelope/`; } /** Returns a URL-encoded string with auth config suitable for a query string. */ function _encodedAuth(dsn, sdkInfo) { return (0,object/* urlEncode */._j)({ // We send only the minimum set of required information. See // https://github.com/getsentry/sentry-javascript/issues/2572. sentry_key: dsn.publicKey, sentry_version: SENTRY_API_VERSION, ...(sdkInfo && { sentry_client: `${sdkInfo.name}/${sdkInfo.version}` }), }); } /** * Returns the envelope endpoint URL with auth in the query string. * * Sending auth as part of the query string and not as custom HTTP headers avoids CORS preflight requests. */ function getEnvelopeEndpointWithUrlEncodedAuth( dsn, // TODO (v8): Remove `tunnelOrOptions` in favor of `options`, and use the substitute code below // options: ClientOptions = {} as ClientOptions, tunnelOrOptions = {} , ) { // TODO (v8): Use this code instead // const { tunnel, _metadata = {} } = options; // return tunnel ? tunnel : `${_getIngestEndpoint(dsn)}?${_encodedAuth(dsn, _metadata.sdk)}`; var tunnel = typeof tunnelOrOptions === 'string' ? tunnelOrOptions : tunnelOrOptions.tunnel; var sdkInfo = typeof tunnelOrOptions === 'string' || !tunnelOrOptions._metadata ? undefined : tunnelOrOptions._metadata.sdk; return tunnel ? tunnel : `${_getIngestEndpoint(dsn)}?${_encodedAuth(dsn, sdkInfo)}`; } /** Returns the url to the report dialog endpoint. */ function getReportDialogEndpoint( dsnLike, dialogOptions , ) { var dsn = makeDsn(dsnLike); var endpoint = `${getBaseApiEndpoint(dsn)}embed/error-page/`; let encodedOptions = `dsn=${dsnToString(dsn)}`; for (var key in dialogOptions) { if (key === 'dsn') { continue; } if (key === 'user') { var user = dialogOptions.user; if (!user) { continue; } if (user.name) { encodedOptions += `&name=${encodeURIComponent(user.name)}`; } if (user.email) { encodedOptions += `&email=${encodeURIComponent(user.email)}`; } } else { encodedOptions += `&${encodeURIComponent(key)}=${encodeURIComponent(dialogOptions[key] )}`; } } return `${endpoint}?${encodedOptions}`; } //# sourceMappingURL=api.js.map // EXTERNAL MODULE: ./node_modules/@sentry/utils/esm/global.js var esm_global = __webpack_require__(82991); // EXTERNAL MODULE: ./node_modules/@sentry/utils/esm/stacktrace.js var stacktrace = __webpack_require__(30360); // EXTERNAL MODULE: ./node_modules/@sentry/utils/esm/supports.js var supports = __webpack_require__(8823); // EXTERNAL MODULE: ./node_modules/@sentry/utils/esm/instrument.js var instrument = __webpack_require__(9732); // EXTERNAL MODULE: ./node_modules/@sentry/hub/esm/session.js var esm_session = __webpack_require__(95771); // EXTERNAL MODULE: ./node_modules/@sentry/utils/esm/misc.js var misc = __webpack_require__(62844); // EXTERNAL MODULE: ./node_modules/@sentry/utils/esm/is.js var is = __webpack_require__(67597); // EXTERNAL MODULE: ./node_modules/@sentry/utils/esm/syncpromise.js var syncpromise = __webpack_require__(96893); ;// CONCATENATED MODULE: ./node_modules/@sentry/utils/esm/envelope.js /** * Creates an envelope. * Make sure to always explicitly provide the generic to this function * so that the envelope types resolve correctly. */ function createEnvelope(headers, items = []) { return [headers, items] ; } /** * Add an item to an envelope. * Make sure to always explicitly provide the generic to this function * so that the envelope types resolve correctly. */ function addItemToEnvelope(envelope, newItem) { const [headers, items] = envelope; return [headers, [...items, newItem]] ; } /** * Convenience function to loop through the items and item types of an envelope. * (This function was mostly created because working with envelope types is painful at the moment) */ function forEachEnvelopeItem( envelope, callback, ) { var envelopeItems = envelope[1]; envelopeItems.forEach((envelopeItem) => { var envelopeItemType = envelopeItem[0].type; callback(envelopeItem, envelopeItemType); }); } function encodeUTF8(input, textEncoder) { var utf8 = textEncoder || new TextEncoder(); return utf8.encode(input); } /** * Serializes an envelope. */ function serializeEnvelope(envelope, textEncoder) { const [envHeaders, items] = envelope; // Initially we construct our envelope as a string and only convert to binary chunks if we encounter binary data let parts = JSON.stringify(envHeaders); function append(next) { if (typeof parts === 'string') { parts = typeof next === 'string' ? parts + next : [encodeUTF8(parts, textEncoder), next]; } else { parts.push(typeof next === 'string' ? encodeUTF8(next, textEncoder) : next); } } for (var item of items) { const [itemHeaders, payload] = item ; append(`\n${JSON.stringify(itemHeaders)}\n`); append(typeof payload === 'string' || payload instanceof Uint8Array ? payload : JSON.stringify(payload)); } return typeof parts === 'string' ? parts : concatBuffers(parts); } function concatBuffers(buffers) { var totalLength = buffers.reduce((acc, buf) => acc + buf.length, 0); var merged = new Uint8Array(totalLength); let offset = 0; for (var buffer of buffers) { merged.set(buffer, offset); offset += buffer.length; } return merged; } /** * Creates attachment envelope items */ function createAttachmentEnvelopeItem( attachment, textEncoder, ) { var buffer = typeof attachment.data === 'string' ? encodeUTF8(attachment.data, textEncoder) : attachment.data; return [ (0,object/* dropUndefinedKeys */.Jr)({ type: 'attachment', length: buffer.length, filename: attachment.filename, content_type: attachment.contentType, attachment_type: attachment.attachmentType, }), buffer, ]; } var ITEM_TYPE_TO_DATA_CATEGORY_MAP = { session: 'session', sessions: 'session', attachment: 'attachment', transaction: 'transaction', event: 'error', client_report: 'internal', user_report: 'default', }; /** * Maps the type of an envelope item to a data category. */ function envelopeItemTypeToDataCategory(type) { return ITEM_TYPE_TO_DATA_CATEGORY_MAP[type]; } //# sourceMappingURL=envelope.js.map // EXTERNAL MODULE: ./node_modules/@sentry/utils/esm/time.js var time = __webpack_require__(21170); // EXTERNAL MODULE: ./node_modules/@sentry/utils/esm/normalize.js + 1 modules var normalize = __webpack_require__(34754); // EXTERNAL MODULE: ./node_modules/@sentry/utils/esm/string.js var string = __webpack_require__(57321); // EXTERNAL MODULE: ./node_modules/@sentry/utils/esm/baggage.js var esm_baggage = __webpack_require__(99181); ;// CONCATENATED MODULE: ./node_modules/@sentry/core/esm/envelope.js /** Extract sdk info from from the API metadata */ function getSdkMetadataForEnvelopeHeader(metadata) { if (!metadata || !metadata.sdk) { return; } const { name, version } = metadata.sdk; return { name, version }; } /** * Apply SdkInfo (name, version, packages, integrations) to the corresponding event key. * Merge with existing data if any. **/ function enhanceEventWithSdkInfo(event, sdkInfo) { if (!sdkInfo) { return event; } event.sdk = event.sdk || {}; event.sdk.name = event.sdk.name || sdkInfo.name; event.sdk.version = event.sdk.version || sdkInfo.version; event.sdk.integrations = [...(event.sdk.integrations || []), ...(sdkInfo.integrations || [])]; event.sdk.packages = [...(event.sdk.packages || []), ...(sdkInfo.packages || [])]; return event; } /** Creates an envelope from a Session */ function createSessionEnvelope( session, dsn, metadata, tunnel, ) { var sdkInfo = getSdkMetadataForEnvelopeHeader(metadata); var envelopeHeaders = { sent_at: new Date().toISOString(), ...(sdkInfo && { sdk: sdkInfo }), ...(!!tunnel && { dsn: dsnToString(dsn) }), }; var envelopeItem = 'aggregates' in session ? [{ type: 'sessions' }, session] : [{ type: 'session' }, session]; return createEnvelope(envelopeHeaders, [envelopeItem]); } /** * Create an Envelope from an event. */ function createEventEnvelope( event, dsn, metadata, tunnel, ) { var sdkInfo = getSdkMetadataForEnvelopeHeader(metadata); var eventType = event.type || 'event'; const { transactionSampling } = event.sdkProcessingMetadata || {}; const { method: samplingMethod, rate: sampleRate } = transactionSampling || {}; enhanceEventWithSdkInfo(event, metadata && metadata.sdk); var envelopeHeaders = createEventEnvelopeHeaders(event, sdkInfo, tunnel, dsn); // Prevent this data (which, if it exists, was used in earlier steps in the processing pipeline) from being sent to // sentry. (Note: Our use of this property comes and goes with whatever we might be debugging, whatever hacks we may // have temporarily added, etc. Even if we don't happen to be using it at some point in the future, let's not get rid // of this `delete`, lest we miss putting it back in the next time the property is in use.) delete event.sdkProcessingMetadata; var eventItem = [ { type: eventType, sample_rates: [{ id: samplingMethod, rate: sampleRate }], }, event, ]; return createEnvelope(envelopeHeaders, [eventItem]); } function createEventEnvelopeHeaders( event, sdkInfo, tunnel, dsn, ) { var baggage = event.sdkProcessingMetadata && event.sdkProcessingMetadata.baggage; var dynamicSamplingContext = baggage && (0,esm_baggage/* getSentryBaggageItems */.Hk)(baggage); return { event_id: event.event_id , sent_at: new Date().toISOString(), ...(sdkInfo && { sdk: sdkInfo }), ...(!!tunnel && { dsn: dsnToString(dsn) }), ...(event.type === 'transaction' && dynamicSamplingContext && { trace: (0,object/* dropUndefinedKeys */.Jr)({ ...dynamicSamplingContext }) , }), }; } //# sourceMappingURL=envelope.js.map ;// CONCATENATED MODULE: ./node_modules/@sentry/core/esm/baseclient.js var ALREADY_SEEN_ERROR = "Not capturing exception because it's already been captured."; /** * Base implementation for all JavaScript SDK clients. * * Call the constructor with the corresponding options * specific to the client subclass. To access these options later, use * {@link Client.getOptions}. * * If a Dsn is specified in the options, it will be parsed and stored. Use * {@link Client.getDsn} to retrieve the Dsn at any moment. In case the Dsn is * invalid, the constructor will throw a {@link SentryException}. Note that * without a valid Dsn, the SDK will not send any events to Sentry. * * Before sending an event, it is passed through * {@link BaseClient._prepareEvent} to add SDK information and scope data * (breadcrumbs and context). To add more custom information, override this * method and extend the resulting prepared event. * * To issue automatically created events (e.g. via instrumentation), use * {@link Client.captureEvent}. It will prepare the event and pass it through * the callback lifecycle. To issue auto-breadcrumbs, use * {@link Client.addBreadcrumb}. * * @example * class NodeClient extends BaseClient { * public constructor(options: NodeOptions) { * super(options); * } * * // ... * } */ class BaseClient { /** Options passed to the SDK. */ /** The client Dsn, if specified in options. Without this Dsn, the SDK will be disabled. */ /** Array of set up integrations. */ __init() {this._integrations = {};} /** Indicates whether this client's integrations have been set up. */ __init2() {this._integrationsInitialized = false;} /** Number of calls being processed */ __init3() {this._numProcessing = 0;} /** Holds flushable */ __init4() {this._outcomes = {};} /** * Initializes this client instance. * * @param options Options for the client. */ constructor(options) {;BaseClient.prototype.__init.call(this);BaseClient.prototype.__init2.call(this);BaseClient.prototype.__init3.call(this);BaseClient.prototype.__init4.call(this); this._options = options; if (options.dsn) { this._dsn = makeDsn(options.dsn); var url = getEnvelopeEndpointWithUrlEncodedAuth(this._dsn, options); this._transport = options.transport({ recordDroppedEvent: this.recordDroppedEvent.bind(this), ...options.transportOptions, url, }); } else { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && esm_logger/* logger.warn */.kg.warn('No DSN provided, client will not do anything.'); } } /** * @inheritDoc */ captureException(exception, hint, scope) { // ensure we haven't captured this very object before if ((0,misc/* checkOrSetAlreadyCaught */.YO)(exception)) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && esm_logger/* logger.log */.kg.log(ALREADY_SEEN_ERROR); return; } let eventId = hint && hint.event_id; this._process( this.eventFromException(exception, hint) .then(event => this._captureEvent(event, hint, scope)) .then(result => { eventId = result; }), ); return eventId; } /** * @inheritDoc */ captureMessage( message, level, hint, scope, ) { let eventId = hint && hint.event_id; var promisedEvent = (0,is/* isPrimitive */.pt)(message) ? this.eventFromMessage(String(message), level, hint) : this.eventFromException(message, hint); this._process( promisedEvent .then(event => this._captureEvent(event, hint, scope)) .then(result => { eventId = result; }), ); return eventId; } /** * @inheritDoc */ captureEvent(event, hint, scope) { // ensure we haven't captured this very object before if (hint && hint.originalException && (0,misc/* checkOrSetAlreadyCaught */.YO)(hint.originalException)) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && esm_logger/* logger.log */.kg.log(ALREADY_SEEN_ERROR); return; } let eventId = hint && hint.event_id; this._process( this._captureEvent(event, hint, scope).then(result => { eventId = result; }), ); return eventId; } /** * @inheritDoc */ captureSession(session) { if (!this._isEnabled()) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && esm_logger/* logger.warn */.kg.warn('SDK not enabled, will not capture session.'); return; } if (!(typeof session.release === 'string')) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && esm_logger/* logger.warn */.kg.warn('Discarded session because of missing or non-string release'); } else { this.sendSession(session); // After sending, we set init false to indicate it's not the first occurrence (0,esm_session/* updateSession */.CT)(session, { init: false }); } } /** * @inheritDoc */ getDsn() { return this._dsn; } /** * @inheritDoc */ getOptions() { return this._options; } /** * @inheritDoc */ getTransport() { return this._transport; } /** * @inheritDoc */ flush(timeout) { var transport = this._transport; if (transport) { return this._isClientDoneProcessing(timeout).then(clientFinished => { return transport.flush(timeout).then(transportFlushed => clientFinished && transportFlushed); }); } else { return (0,syncpromise/* resolvedSyncPromise */.WD)(true); } } /** * @inheritDoc */ close(timeout) { return this.flush(timeout).then(result => { this.getOptions().enabled = false; return result; }); } /** * Sets up the integrations */ setupIntegrations() { if (this._isEnabled() && !this._integrationsInitialized) { this._integrations = setupIntegrations(this._options.integrations); this._integrationsInitialized = true; } } /** * Gets an installed integration by its `id`. * * @returns The installed integration or `undefined` if no integration with that `id` was installed. */ getIntegrationById(integrationId) { return this._integrations[integrationId]; } /** * @inheritDoc */ getIntegration(integration) { try { return (this._integrations[integration.id] ) || null; } catch (_oO) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && esm_logger/* logger.warn */.kg.warn(`Cannot retrieve integration ${integration.id} from the current Client`); return null; } } /** * @inheritDoc */ sendEvent(event, hint = {}) { if (this._dsn) { let env = createEventEnvelope(event, this._dsn, this._options._metadata, this._options.tunnel); for (var attachment of hint.attachments || []) { env = addItemToEnvelope( env, createAttachmentEnvelopeItem( attachment, this._options.transportOptions && this._options.transportOptions.textEncoder, ), ); } this._sendEnvelope(env); } } /** * @inheritDoc */ sendSession(session) { if (this._dsn) { var env = createSessionEnvelope(session, this._dsn, this._options._metadata, this._options.tunnel); this._sendEnvelope(env); } } /** * @inheritDoc */ recordDroppedEvent(reason, category) { if (this._options.sendClientReports) { // We want to track each category (error, transaction, session) separately // but still keep the distinction between different type of outcomes. // We could use nested maps, but it's much easier to read and type this way. // A correct type for map-based implementation if we want to go that route // would be `Partial>>>` // With typescript 4.1 we could even use template literal types var key = `${reason}:${category}`; (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && esm_logger/* logger.log */.kg.log(`Adding outcome: "${key}"`); // The following works because undefined + 1 === NaN and NaN is falsy this._outcomes[key] = this._outcomes[key] + 1 || 1; } } /** Updates existing session based on the provided event */ _updateSessionFromEvent(session, event) { let crashed = false; let errored = false; var exceptions = event.exception && event.exception.values; if (exceptions) { errored = true; for (var ex of exceptions) { var mechanism = ex.mechanism; if (mechanism && mechanism.handled === false) { crashed = true; break; } } } // A session is updated and that session update is sent in only one of the two following scenarios: // 1. Session with non terminal status and 0 errors + an error occurred -> Will set error count to 1 and send update // 2. Session with non terminal status and 1 error + a crash occurred -> Will set status crashed and send update var sessionNonTerminal = session.status === 'ok'; var shouldUpdateAndSend = (sessionNonTerminal && session.errors === 0) || (sessionNonTerminal && crashed); if (shouldUpdateAndSend) { (0,esm_session/* updateSession */.CT)(session, { ...(crashed && { status: 'crashed' }), errors: session.errors || Number(errored || crashed), }); this.captureSession(session); } } /** * Determine if the client is finished processing. Returns a promise because it will wait `timeout` ms before saying * "no" (resolving to `false`) in order to give the client a chance to potentially finish first. * * @param timeout The time, in ms, after which to resolve to `false` if the client is still busy. Passing `0` (or not * passing anything) will make the promise wait as long as it takes for processing to finish before resolving to * `true`. * @returns A promise which will resolve to `true` if processing is already done or finishes before the timeout, and * `false` otherwise */ _isClientDoneProcessing(timeout) { return new syncpromise/* SyncPromise */.cW(resolve => { let ticked = 0; var tick = 1; var interval = setInterval(() => { if (this._numProcessing == 0) { clearInterval(interval); resolve(true); } else { ticked += tick; if (timeout && ticked >= timeout) { clearInterval(interval); resolve(false); } } }, tick); }); } /** Determines whether this SDK is enabled and a valid Dsn is present. */ _isEnabled() { return this.getOptions().enabled !== false && this._dsn !== undefined; } /** * Adds common information to events. * * The information includes release and environment from `options`, * breadcrumbs and context (extra, tags and user) from the scope. * * Information that is already present in the event is never overwritten. For * nested objects, such as the context, keys are merged. * * @param event The original event. * @param hint May contain additional information about the original exception. * @param scope A scope containing event metadata. * @returns A new event with more information. */ _prepareEvent(event, hint, scope) { const { normalizeDepth = 3, normalizeMaxBreadth = 1000 } = this.getOptions(); var prepared = { ...event, event_id: event.event_id || hint.event_id || (0,misc/* uuid4 */.DM)(), timestamp: event.timestamp || (0,time/* dateTimestampInSeconds */.yW)(), }; this._applyClientOptions(prepared); this._applyIntegrationsMetadata(prepared); // If we have scope given to us, use it as the base for further modifications. // This allows us to prevent unnecessary copying of data if `captureContext` is not provided. let finalScope = scope; if (hint.captureContext) { finalScope = esm_scope/* Scope.clone */.s.clone(finalScope).update(hint.captureContext); } // We prepare the result here with a resolved Event. let result = (0,syncpromise/* resolvedSyncPromise */.WD)(prepared); // This should be the last thing called, since we want that // {@link Hub.addEventProcessor} gets the finished prepared event. if (finalScope) { // Collect attachments from the hint and scope var attachments = [...(hint.attachments || []), ...finalScope.getAttachments()]; if (attachments.length) { hint.attachments = attachments; } // In case we have a hub we reassign it. result = finalScope.applyToEvent(prepared, hint); } return result.then(evt => { if (typeof normalizeDepth === 'number' && normalizeDepth > 0) { return this._normalizeEvent(evt, normalizeDepth, normalizeMaxBreadth); } return evt; }); } /** * Applies `normalize` function on necessary `Event` attributes to make them safe for serialization. * Normalized keys: * - `breadcrumbs.data` * - `user` * - `contexts` * - `extra` * @param event Event * @returns Normalized event */ _normalizeEvent(event, depth, maxBreadth) { if (!event) { return null; } var normalized = { ...event, ...(event.breadcrumbs && { breadcrumbs: event.breadcrumbs.map(b => ({ ...b, ...(b.data && { data: (0,normalize/* normalize */.Fv)(b.data, depth, maxBreadth), }), })), }), ...(event.user && { user: (0,normalize/* normalize */.Fv)(event.user, depth, maxBreadth), }), ...(event.contexts && { contexts: (0,normalize/* normalize */.Fv)(event.contexts, depth, maxBreadth), }), ...(event.extra && { extra: (0,normalize/* normalize */.Fv)(event.extra, depth, maxBreadth), }), }; // event.contexts.trace stores information about a Transaction. Similarly, // event.spans[] stores information about child Spans. Given that a // Transaction is conceptually a Span, normalization should apply to both // Transactions and Spans consistently. // For now the decision is to skip normalization of Transactions and Spans, // so this block overwrites the normalized event to add back the original // Transaction information prior to normalization. if (event.contexts && event.contexts.trace && normalized.contexts) { normalized.contexts.trace = event.contexts.trace; // event.contexts.trace.data may contain circular/dangerous data so we need to normalize it if (event.contexts.trace.data) { normalized.contexts.trace.data = (0,normalize/* normalize */.Fv)(event.contexts.trace.data, depth, maxBreadth); } } // event.spans[].data may contain circular/dangerous data so we need to normalize it if (event.spans) { normalized.spans = event.spans.map(span => { // We cannot use the spread operator here because `toJSON` on `span` is non-enumerable if (span.data) { span.data = (0,normalize/* normalize */.Fv)(span.data, depth, maxBreadth); } return span; }); } return normalized; } /** * Enhances event using the client configuration. * It takes care of all "static" values like environment, release and `dist`, * as well as truncating overly long values. * @param event event instance to be enhanced */ _applyClientOptions(event) { var options = this.getOptions(); const { environment, release, dist, maxValueLength = 250 } = options; if (!('environment' in event)) { event.environment = 'environment' in options ? environment : 'production'; } if (event.release === undefined && release !== undefined) { event.release = release; } if (event.dist === undefined && dist !== undefined) { event.dist = dist; } if (event.message) { event.message = (0,string/* truncate */.$G)(event.message, maxValueLength); } var exception = event.exception && event.exception.values && event.exception.values[0]; if (exception && exception.value) { exception.value = (0,string/* truncate */.$G)(exception.value, maxValueLength); } var request = event.request; if (request && request.url) { request.url = (0,string/* truncate */.$G)(request.url, maxValueLength); } } /** * This function adds all used integrations to the SDK info in the event. * @param event The event that will be filled with all integrations. */ _applyIntegrationsMetadata(event) { var integrationsArray = Object.keys(this._integrations); if (integrationsArray.length > 0) { event.sdk = event.sdk || {}; event.sdk.integrations = [...(event.sdk.integrations || []), ...integrationsArray]; } } /** * Processes the event and logs an error in case of rejection * @param event * @param hint * @param scope */ _captureEvent(event, hint = {}, scope) { return this._processEvent(event, hint, scope).then( finalEvent => { return finalEvent.event_id; }, reason => { if ((typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__)) { // If something's gone wrong, log the error as a warning. If it's just us having used a `SentryError` for // control flow, log just the message (no stack) as a log-level log. var sentryError = reason ; if (sentryError.logLevel === 'log') { esm_logger/* logger.log */.kg.log(sentryError.message); } else { esm_logger/* logger.warn */.kg.warn(sentryError); } } return undefined; }, ); } /** * Processes an event (either error or message) and sends it to Sentry. * * This also adds breadcrumbs and context information to the event. However, * platform specific meta data (such as the User's IP address) must be added * by the SDK implementor. * * * @param event The event to send to Sentry. * @param hint May contain additional information about the original exception. * @param scope A scope containing event metadata. * @returns A SyncPromise that resolves with the event or rejects in case event was/will not be send. */ _processEvent(event, hint, scope) { const { beforeSend, sampleRate } = this.getOptions(); if (!this._isEnabled()) { return (0,syncpromise/* rejectedSyncPromise */.$2)(new SentryError('SDK not enabled, will not capture event.', 'log')); } var isTransaction = event.type === 'transaction'; // 1.0 === 100% events are sent // 0.0 === 0% events are sent // Sampling for transaction happens somewhere else if (!isTransaction && typeof sampleRate === 'number' && Math.random() > sampleRate) { this.recordDroppedEvent('sample_rate', 'error'); return (0,syncpromise/* rejectedSyncPromise */.$2)( new SentryError( `Discarding event because it's not included in the random sample (sampling rate = ${sampleRate})`, 'log', ), ); } return this._prepareEvent(event, hint, scope) .then(prepared => { if (prepared === null) { this.recordDroppedEvent('event_processor', event.type || 'error'); throw new SentryError('An event processor returned null, will not send event.', 'log'); } var isInternalException = hint.data && (hint.data ).__sentry__ === true; if (isInternalException || isTransaction || !beforeSend) { return prepared; } var beforeSendResult = beforeSend(prepared, hint); return _ensureBeforeSendRv(beforeSendResult); }) .then(processedEvent => { if (processedEvent === null) { this.recordDroppedEvent('before_send', event.type || 'error'); throw new SentryError('`beforeSend` returned `null`, will not send event.', 'log'); } var session = scope && scope.getSession(); if (!isTransaction && session) { this._updateSessionFromEvent(session, processedEvent); } this.sendEvent(processedEvent, hint); return processedEvent; }) .then(null, reason => { if (reason instanceof SentryError) { throw reason; } this.captureException(reason, { data: { __sentry__: true, }, originalException: reason , }); throw new SentryError( `Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${reason}`, ); }); } /** * Occupies the client with processing and event */ _process(promise) { this._numProcessing += 1; void promise.then( value => { this._numProcessing -= 1; return value; }, reason => { this._numProcessing -= 1; return reason; }, ); } /** * @inheritdoc */ _sendEnvelope(envelope) { if (this._transport && this._dsn) { this._transport.send(envelope).then(null, reason => { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && esm_logger/* logger.error */.kg.error('Error while sending event:', reason); }); } else { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && esm_logger/* logger.error */.kg.error('Transport disabled'); } } /** * Clears outcomes on this client and returns them. */ _clearOutcomes() { var outcomes = this._outcomes; this._outcomes = {}; return Object.keys(outcomes).map(key => { const [reason, category] = key.split(':') ; return { reason, category, quantity: outcomes[key], }; }); } /** * @inheritDoc */ } /** * Verifies that return value of configured `beforeSend` is of expected type. */ function _ensureBeforeSendRv(rv) { var nullErr = '`beforeSend` method has to return `null` or a valid event.'; if ((0,is/* isThenable */.J8)(rv)) { return rv.then( event => { if (!((0,is/* isPlainObject */.PO)(event) || event === null)) { throw new SentryError(nullErr); } return event; }, e => { throw new SentryError(`beforeSend rejected with ${e}`); }, ); } else if (!((0,is/* isPlainObject */.PO)(rv) || rv === null)) { throw new SentryError(nullErr); } return rv; } //# sourceMappingURL=baseclient.js.map // EXTERNAL MODULE: ./node_modules/@sentry/core/esm/version.js var version = __webpack_require__(40105); ;// CONCATENATED MODULE: ./node_modules/@sentry/utils/esm/clientreport.js /** * Creates client report envelope * @param discarded_events An array of discard events * @param dsn A DSN that can be set on the header. Optional. */ function createClientReportEnvelope( discarded_events, dsn, timestamp, ) { var clientReportItem = [ { type: 'client_report' }, { timestamp: timestamp || (0,time/* dateTimestampInSeconds */.yW)(), discarded_events, }, ]; return createEnvelope(dsn ? { dsn } : {}, [clientReportItem]); } //# sourceMappingURL=clientreport.js.map // EXTERNAL MODULE: ./node_modules/@sentry/browser/esm/eventbuilder.js var eventbuilder = __webpack_require__(84773); // EXTERNAL MODULE: ./node_modules/@sentry/browser/esm/integrations/breadcrumbs.js + 1 modules var breadcrumbs = __webpack_require__(71861); ;// CONCATENATED MODULE: ./node_modules/@sentry/browser/esm/transports/utils.js var global = (0,esm_global/* getGlobalObject */.R)(); let cachedFetchImpl; /** * A special usecase for incorrectly wrapped Fetch APIs in conjunction with ad-blockers. * Whenever someone wraps the Fetch API and returns the wrong promise chain, * this chain becomes orphaned and there is no possible way to capture it's rejections * other than allowing it bubble up to this very handler. eg. * * var f = window.fetch; * window.fetch = function () { * var p = f.apply(this, arguments); * * p.then(function() { * console.log('hi.'); * }); * * return p; * } * * `p.then(function () { ... })` is producing a completely separate promise chain, * however, what's returned is `p` - the result of original `fetch` call. * * This mean, that whenever we use the Fetch API to send our own requests, _and_ * some ad-blocker blocks it, this orphaned chain will _always_ reject, * effectively causing another event to be captured. * This makes a whole process become an infinite loop, which we need to somehow * deal with, and break it in one way or another. * * To deal with this issue, we are making sure that we _always_ use the real * browser Fetch API, instead of relying on what `window.fetch` exposes. * The only downside to this would be missing our own requests as breadcrumbs, * but because we are already not doing this, it should be just fine. * * Possible failed fetch error messages per-browser: * * Chrome: Failed to fetch * Edge: Failed to Fetch * Firefox: NetworkError when attempting to fetch resource * Safari: resource blocked by content blocker */ function getNativeFetchImplementation() { if (cachedFetchImpl) { return cachedFetchImpl; } // Fast path to avoid DOM I/O if ((0,supports/* isNativeFetch */.Du)(global.fetch)) { return (cachedFetchImpl = global.fetch.bind(global)); } var document = global.document; let fetchImpl = global.fetch; if (document && typeof document.createElement === 'function') { try { var sandbox = document.createElement('iframe'); sandbox.hidden = true; document.head.appendChild(sandbox); var contentWindow = sandbox.contentWindow; if (contentWindow && contentWindow.fetch) { fetchImpl = contentWindow.fetch; } document.head.removeChild(sandbox); } catch (e) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && esm_logger/* logger.warn */.kg.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ', e); } } return (cachedFetchImpl = fetchImpl.bind(global)); } /** * Sends sdk client report using sendBeacon or fetch as a fallback if available * * @param url report endpoint * @param body report payload */ function sendReport(url, body) { var isRealNavigator = Object.prototype.toString.call(global && global.navigator) === '[object Navigator]'; var hasSendBeacon = isRealNavigator && typeof global.navigator.sendBeacon === 'function'; if (hasSendBeacon) { // Prevent illegal invocations - https://xgwang.me/posts/you-may-not-know-beacon/#it-may-throw-error%2C-be-sure-to-catch var sendBeacon = global.navigator.sendBeacon.bind(global.navigator); sendBeacon(url, body); } else if ((0,supports/* supportsFetch */.Ak)()) { var fetch = getNativeFetchImplementation(); fetch(url, { body, method: 'POST', credentials: 'omit', keepalive: true, }).then(null, error => { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && esm_logger/* logger.error */.kg.error(error); }); } } //# sourceMappingURL=utils.js.map ;// CONCATENATED MODULE: ./node_modules/@sentry/browser/esm/client.js var globalObject = (0,esm_global/* getGlobalObject */.R)(); /** * The Sentry Browser SDK Client. * * @see BrowserOptions for documentation on configuration options. * @see SentryClient for usage documentation. */ class BrowserClient extends BaseClient { /** * Creates a new Browser SDK instance. * * @param options Configuration options for this SDK. */ constructor(options) { options._metadata = options._metadata || {}; options._metadata.sdk = options._metadata.sdk || { name: 'sentry.javascript.browser', packages: [ { name: 'npm:@sentry/browser', version: version/* SDK_VERSION */.J, }, ], version: version/* SDK_VERSION */.J, }; super(options); if (options.sendClientReports && globalObject.document) { globalObject.document.addEventListener('visibilitychange', () => { if (globalObject.document.visibilityState === 'hidden') { this._flushOutcomes(); } }); } } /** * @inheritDoc */ eventFromException(exception, hint) { return (0,eventbuilder/* eventFromException */.dr)(this._options.stackParser, exception, hint, this._options.attachStacktrace); } /** * @inheritDoc */ eventFromMessage( message, level = 'info', hint, ) { return (0,eventbuilder/* eventFromMessage */.aB)(this._options.stackParser, message, level, hint, this._options.attachStacktrace); } /** * @inheritDoc */ sendEvent(event, hint) { // We only want to add the sentry event breadcrumb when the user has the breadcrumb integration installed and // activated its `sentry` option. // We also do not want to use the `Breadcrumbs` class here directly, because we do not want it to be included in // bundles, if it is not used by the SDK. // This all sadly is a bit ugly, but we currently don't have a "pre-send" hook on the integrations so we do it this // way for now. var breadcrumbIntegration = this.getIntegrationById(breadcrumbs/* BREADCRUMB_INTEGRATION_ID */.p) ; if ( breadcrumbIntegration && // We check for definedness of `options`, even though it is not strictly necessary, because that access to // `.sentry` below does not throw, in case users provided their own integration with id "Breadcrumbs" that does // not have an`options` field breadcrumbIntegration.options && breadcrumbIntegration.options.sentry ) { (0,esm_hub/* getCurrentHub */.Gd)().addBreadcrumb( { category: `sentry.${event.type === 'transaction' ? 'transaction' : 'event'}`, event_id: event.event_id, level: event.level, message: (0,misc/* getEventDescription */.jH)(event), }, { event, }, ); } super.sendEvent(event, hint); } /** * @inheritDoc */ _prepareEvent(event, hint, scope) { event.platform = event.platform || 'javascript'; return super._prepareEvent(event, hint, scope); } /** * Sends client reports as an envelope. */ _flushOutcomes() { var outcomes = this._clearOutcomes(); if (outcomes.length === 0) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && esm_logger/* logger.log */.kg.log('No outcomes to send'); return; } if (!this._dsn) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && esm_logger/* logger.log */.kg.log('No dsn provided, will not send outcomes'); return; } (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && esm_logger/* logger.log */.kg.log('Sending outcomes:', outcomes); var url = getEnvelopeEndpointWithUrlEncodedAuth(this._dsn, this._options); var envelope = createClientReportEnvelope(outcomes, this._options.tunnel && dsnToString(this._dsn)); try { sendReport(url, serializeEnvelope(envelope)); } catch (e) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && esm_logger/* logger.error */.kg.error(e); } } } //# sourceMappingURL=client.js.map ;// CONCATENATED MODULE: ./node_modules/@sentry/browser/esm/stack-parsers.js // global reference to slice var UNKNOWN_FUNCTION = '?'; var OPERA10_PRIORITY = 10; var OPERA11_PRIORITY = 20; var CHROME_PRIORITY = 30; var WINJS_PRIORITY = 40; var GECKO_PRIORITY = 50; function createFrame(filename, func, lineno, colno) { var frame = { filename, function: func, // All browser frames are considered in_app in_app: true, }; if (lineno !== undefined) { frame.lineno = lineno; } if (colno !== undefined) { frame.colno = colno; } return frame; } // Chromium based browsers: Chrome, Brave, new Opera, new Edge var chromeRegex = /^\s*at (?:(.*\).*?|.*?) ?\((?:address at )?)?((?:file|https?|blob|chrome-extension|address|native|eval|webpack||[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i; var chromeEvalRegex = /\((\S*)(?::(\d+))(?::(\d+))\)/; var chrome = line => { var parts = chromeRegex.exec(line); if (parts) { var isEval = parts[2] && parts[2].indexOf('eval') === 0; // start of line if (isEval) { var subMatch = chromeEvalRegex.exec(parts[2]); if (subMatch) { // throw out eval line/column and use top-most line/column number parts[2] = subMatch[1]; // url parts[3] = subMatch[2]; // line parts[4] = subMatch[3]; // column } } // Kamil: One more hack won't hurt us right? Understanding and adding more rules on top of these regexps right now // would be way too time consuming. (TODO: Rewrite whole RegExp to be more readable) const [func, filename] = extractSafariExtensionDetails(parts[1] || UNKNOWN_FUNCTION, parts[2]); return createFrame(filename, func, parts[3] ? +parts[3] : undefined, parts[4] ? +parts[4] : undefined); } return; }; var chromeStackLineParser = [CHROME_PRIORITY, chrome]; // gecko regex: `(?:bundle|\d+\.js)`: `bundle` is for react native, `\d+\.js` also but specifically for ram bundles because it // generates filenames without a prefix like `file://` the filenames in the stacktrace are just 42.js // We need this specific case for now because we want no other regex to match. var geckoREgex = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension|safari-extension|safari-web-extension|capacitor)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i; var geckoEvalRegex = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i; var gecko = line => { var parts = geckoREgex.exec(line); if (parts) { var isEval = parts[3] && parts[3].indexOf(' > eval') > -1; if (isEval) { var subMatch = geckoEvalRegex.exec(parts[3]); if (subMatch) { // throw out eval line/column and use top-most line number parts[1] = parts[1] || 'eval'; parts[3] = subMatch[1]; parts[4] = subMatch[2]; parts[5] = ''; // no column when eval } } let filename = parts[3]; let func = parts[1] || UNKNOWN_FUNCTION; [func, filename] = extractSafariExtensionDetails(func, filename); return createFrame(filename, func, parts[4] ? +parts[4] : undefined, parts[5] ? +parts[5] : undefined); } return; }; var geckoStackLineParser = [GECKO_PRIORITY, gecko]; var winjsRegex = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i; var winjs = line => { var parts = winjsRegex.exec(line); return parts ? createFrame(parts[2], parts[1] || UNKNOWN_FUNCTION, +parts[3], parts[4] ? +parts[4] : undefined) : undefined; }; var winjsStackLineParser = [WINJS_PRIORITY, winjs]; var opera10Regex = / line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i; var opera10 = line => { var parts = opera10Regex.exec(line); return parts ? createFrame(parts[2], parts[3] || UNKNOWN_FUNCTION, +parts[1]) : undefined; }; var opera10StackLineParser = [OPERA10_PRIORITY, opera10]; var opera11Regex = / line (\d+), column (\d+)\s*(?:in (?:]+)>|([^)]+))\(.*\))? in (.*):\s*$/i; var opera11 = line => { var parts = opera11Regex.exec(line); return parts ? createFrame(parts[5], parts[3] || parts[4] || UNKNOWN_FUNCTION, +parts[1], +parts[2]) : undefined; }; var opera11StackLineParser = [OPERA11_PRIORITY, opera11]; var defaultStackLineParsers = [chromeStackLineParser, geckoStackLineParser, winjsStackLineParser]; var defaultStackParser = (0,stacktrace/* createStackParser */.pE)(...defaultStackLineParsers); /** * Safari web extensions, starting version unknown, can produce "frames-only" stacktraces. * What it means, is that instead of format like: * * Error: wat * at function@url:row:col * at function@url:row:col * at function@url:row:col * * it produces something like: * * function@url:row:col * function@url:row:col * function@url:row:col * * Because of that, it won't be captured by `chrome` RegExp and will fall into `Gecko` branch. * This function is extracted so that we can use it in both places without duplicating the logic. * Unfortunately "just" changing RegExp is too complicated now and making it pass all tests * and fix this case seems like an impossible, or at least way too time-consuming task. */ var extractSafariExtensionDetails = (func, filename) => { var isSafariExtension = func.indexOf('safari-extension') !== -1; var isSafariWebExtension = func.indexOf('safari-web-extension') !== -1; return isSafariExtension || isSafariWebExtension ? [ func.indexOf('@') !== -1 ? func.split('@')[0] : UNKNOWN_FUNCTION, isSafariExtension ? `safari-extension:${filename}` : `safari-web-extension:${filename}`, ] : [func, filename]; }; //# sourceMappingURL=stack-parsers.js.map // EXTERNAL MODULE: ./node_modules/@sentry/browser/esm/integrations/trycatch.js var trycatch = __webpack_require__(53692); // EXTERNAL MODULE: ./node_modules/@sentry/browser/esm/integrations/globalhandlers.js var globalhandlers = __webpack_require__(52136); // EXTERNAL MODULE: ./node_modules/@sentry/browser/esm/integrations/linkederrors.js var linkederrors = __webpack_require__(61634); // EXTERNAL MODULE: ./node_modules/@sentry/browser/esm/integrations/dedupe.js var dedupe = __webpack_require__(69730); // EXTERNAL MODULE: ./node_modules/@sentry/browser/esm/integrations/httpcontext.js var httpcontext = __webpack_require__(61945); ;// CONCATENATED MODULE: ./node_modules/@sentry/utils/esm/promisebuffer.js /** * Creates an new PromiseBuffer object with the specified limit * @param limit max number of promises that can be stored in the buffer */ function makePromiseBuffer(limit) { var buffer = []; function isReady() { return limit === undefined || buffer.length < limit; } /** * Remove a promise from the queue. * * @param task Can be any PromiseLike * @returns Removed promise. */ function remove(task) { return buffer.splice(buffer.indexOf(task), 1)[0]; } /** * Add a promise (representing an in-flight action) to the queue, and set it to remove itself on fulfillment. * * @param taskProducer A function producing any PromiseLike; In previous versions this used to be `task: * PromiseLike`, but under that model, Promises were instantly created on the call-site and their executor * functions therefore ran immediately. Thus, even if the buffer was full, the action still happened. By * requiring the promise to be wrapped in a function, we can defer promise creation until after the buffer * limit check. * @returns The original promise. */ function add(taskProducer) { if (!isReady()) { return (0,syncpromise/* rejectedSyncPromise */.$2)(new SentryError('Not adding Promise due to buffer limit reached.')); } // start the task and add its promise to the queue var task = taskProducer(); if (buffer.indexOf(task) === -1) { buffer.push(task); } void task .then(() => remove(task)) // Use `then(null, rejectionHandler)` rather than `catch(rejectionHandler)` so that we can use `PromiseLike` // rather than `Promise`. `PromiseLike` doesn't have a `.catch` method, making its polyfill smaller. (ES5 didn't // have promises, so TS has to polyfill when down-compiling.) .then(null, () => remove(task).then(null, () => { // We have to add another catch here because `remove()` starts a new promise chain. }), ); return task; } /** * Wait for all promises in the queue to resolve or for timeout to expire, whichever comes first. * * @param timeout The time, in ms, after which to resolve to `false` if the queue is still non-empty. Passing `0` (or * not passing anything) will make the promise wait as long as it takes for the queue to drain before resolving to * `true`. * @returns A promise which will resolve to `true` if the queue is already empty or drains before the timeout, and * `false` otherwise */ function drain(timeout) { return new syncpromise/* SyncPromise */.cW((resolve, reject) => { let counter = buffer.length; if (!counter) { return resolve(true); } // wait for `timeout` ms and then resolve to `false` (if not cancelled first) var capturedSetTimeout = setTimeout(() => { if (timeout && timeout > 0) { resolve(false); } }, timeout); // if all promises resolve in time, cancel the timer and resolve to `true` buffer.forEach(item => { void (0,syncpromise/* resolvedSyncPromise */.WD)(item).then(() => { if (!--counter) { clearTimeout(capturedSetTimeout); resolve(true); } }, reject); }); }); } return { $: buffer, add, drain, }; } //# sourceMappingURL=promisebuffer.js.map ;// CONCATENATED MODULE: ./node_modules/@sentry/utils/esm/ratelimit.js // Intentionally keeping the key broad, as we don't know for sure what rate limit headers get returned from backend var DEFAULT_RETRY_AFTER = 60 * 1000; // 60 seconds /** * Extracts Retry-After value from the request header or returns default value * @param header string representation of 'Retry-After' header * @param now current unix timestamp * */ function parseRetryAfterHeader(header, now = Date.now()) { var headerDelay = parseInt(`${header}`, 10); if (!isNaN(headerDelay)) { return headerDelay * 1000; } var headerDate = Date.parse(`${header}`); if (!isNaN(headerDate)) { return headerDate - now; } return DEFAULT_RETRY_AFTER; } /** * Gets the time that given category is disabled until for rate limiting */ function disabledUntil(limits, category) { return limits[category] || limits.all || 0; } /** * Checks if a category is rate limited */ function isRateLimited(limits, category, now = Date.now()) { return disabledUntil(limits, category) > now; } /** * Update ratelimits from incoming headers. * Returns true if headers contains a non-empty rate limiting header. */ function updateRateLimits( limits, { statusCode, headers }, now = Date.now(), ) { var updatedRateLimits = { ...limits, }; // "The name is case-insensitive." // https://developer.mozilla.org/en-US/docs/Web/API/Headers/get var rateLimitHeader = headers && headers['x-sentry-rate-limits']; var retryAfterHeader = headers && headers['retry-after']; if (rateLimitHeader) { /** * rate limit headers are of the form *
,
,.. * where each
is of the form * : : : * where * is a delay in seconds * is the event type(s) (error, transaction, etc) being rate limited and is of the form * ;;... * is what's being limited (org, project, or key) - ignored by SDK * is an arbitrary string like "org_quota" - ignored by SDK */ for (var limit of rateLimitHeader.trim().split(',')) { const [retryAfter, categories] = limit.split(':', 2); var headerDelay = parseInt(retryAfter, 10); var delay = (!isNaN(headerDelay) ? headerDelay : 60) * 1000; // 60sec default if (!categories) { updatedRateLimits.all = now + delay; } else { for (var category of categories.split(';')) { updatedRateLimits[category] = now + delay; } } } } else if (retryAfterHeader) { updatedRateLimits.all = now + parseRetryAfterHeader(retryAfterHeader, now); } else if (statusCode === 429) { updatedRateLimits.all = now + 60 * 1000; } return updatedRateLimits; } //# sourceMappingURL=ratelimit.js.map ;// CONCATENATED MODULE: ./node_modules/@sentry/core/esm/transports/base.js var DEFAULT_TRANSPORT_BUFFER_SIZE = 30; /** * Creates an instance of a Sentry `Transport` * * @param options * @param makeRequest */ function createTransport( options, makeRequest, buffer = makePromiseBuffer(options.bufferSize || DEFAULT_TRANSPORT_BUFFER_SIZE), ) { let rateLimits = {}; var flush = (timeout) => buffer.drain(timeout); function send(envelope) { var filteredEnvelopeItems = []; // Drop rate limited items from envelope forEachEnvelopeItem(envelope, (item, type) => { var envelopeItemDataCategory = envelopeItemTypeToDataCategory(type); if (isRateLimited(rateLimits, envelopeItemDataCategory)) { options.recordDroppedEvent('ratelimit_backoff', envelopeItemDataCategory); } else { filteredEnvelopeItems.push(item); } }); // Skip sending if envelope is empty after filtering out rate limited events if (filteredEnvelopeItems.length === 0) { return (0,syncpromise/* resolvedSyncPromise */.WD)(); } var filteredEnvelope = createEnvelope(envelope[0], filteredEnvelopeItems ); // Creates client report for each item in an envelope var recordEnvelopeLoss = (reason) => { forEachEnvelopeItem(filteredEnvelope, (_, type) => { options.recordDroppedEvent(reason, envelopeItemTypeToDataCategory(type)); }); }; var requestTask = () => makeRequest({ body: serializeEnvelope(filteredEnvelope, options.textEncoder) }).then( response => { // We don't want to throw on NOK responses, but we want to at least log them if (response.statusCode !== undefined && (response.statusCode < 200 || response.statusCode >= 300)) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && esm_logger/* logger.warn */.kg.warn(`Sentry responded with status code ${response.statusCode} to sent event.`); } rateLimits = updateRateLimits(rateLimits, response); }, error => { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && esm_logger/* logger.error */.kg.error('Failed while sending event:', error); recordEnvelopeLoss('network_error'); }, ); return buffer.add(requestTask).then( result => result, error => { if (error instanceof SentryError) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && esm_logger/* logger.error */.kg.error('Skipped sending event due to full buffer'); recordEnvelopeLoss('queue_overflow'); return (0,syncpromise/* resolvedSyncPromise */.WD)(); } else { throw error; } }, ); } return { send, flush, }; } //# sourceMappingURL=base.js.map ;// CONCATENATED MODULE: ./node_modules/@sentry/browser/esm/transports/fetch.js /** * Creates a Transport that uses the Fetch API to send events to Sentry. */ function makeFetchTransport( options, nativeFetch = getNativeFetchImplementation(), ) { function makeRequest(request) { var requestOptions = { body: request.body, method: 'POST', referrerPolicy: 'origin', headers: options.headers, ...options.fetchOptions, }; return nativeFetch(options.url, requestOptions).then(response => ({ statusCode: response.status, headers: { 'x-sentry-rate-limits': response.headers.get('X-Sentry-Rate-Limits'), 'retry-after': response.headers.get('Retry-After'), }, })); } return createTransport(options, makeRequest); } //# sourceMappingURL=fetch.js.map ;// CONCATENATED MODULE: ./node_modules/@sentry/browser/esm/transports/xhr.js /** * The DONE ready state for XmlHttpRequest * * Defining it here as a constant b/c XMLHttpRequest.DONE is not always defined * (e.g. during testing, it is `undefined`) * * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/readyState} */ var XHR_READYSTATE_DONE = 4; /** * Creates a Transport that uses the XMLHttpRequest API to send events to Sentry. */ function makeXHRTransport(options) { function makeRequest(request) { return new syncpromise/* SyncPromise */.cW((resolve, reject) => { var xhr = new XMLHttpRequest(); xhr.onerror = reject; xhr.onreadystatechange = () => { if (xhr.readyState === XHR_READYSTATE_DONE) { resolve({ statusCode: xhr.status, headers: { 'x-sentry-rate-limits': xhr.getResponseHeader('X-Sentry-Rate-Limits'), 'retry-after': xhr.getResponseHeader('Retry-After'), }, }); } }; xhr.open('POST', options.url); for (var header in options.headers) { if (Object.prototype.hasOwnProperty.call(options.headers, header)) { xhr.setRequestHeader(header, options.headers[header]); } } xhr.send(request.body); }); } return createTransport(options, makeRequest); } //# sourceMappingURL=xhr.js.map ;// CONCATENATED MODULE: ./node_modules/@sentry/browser/esm/sdk.js var defaultIntegrations = [ new inboundfilters/* InboundFilters */.QD(), new functiontostring/* FunctionToString */.c(), new trycatch/* TryCatch */.p(), new breadcrumbs/* Breadcrumbs */.O(), new globalhandlers/* GlobalHandlers */.d(), new linkederrors/* LinkedErrors */.iP(), new dedupe/* Dedupe */.I(), new httpcontext/* HttpContext */.q(), ]; /** * The Sentry Browser SDK Client. * * To use this SDK, call the {@link init} function as early as possible when * loading the web page. To set context information or send manual events, use * the provided methods. * * @example * * ``` * * import { init } from '@sentry/browser'; * * init({ * dsn: '__DSN__', * // ... * }); * ``` * * @example * ``` * * import { configureScope } from '@sentry/browser'; * configureScope((scope: Scope) => { * scope.setExtra({ battery: 0.7 }); * scope.setTag({ user_mode: 'admin' }); * scope.setUser({ id: '4711' }); * }); * ``` * * @example * ``` * * import { addBreadcrumb } from '@sentry/browser'; * addBreadcrumb({ * message: 'My Breadcrumb', * // ... * }); * ``` * * @example * * ``` * * import * as Sentry from '@sentry/browser'; * Sentry.captureMessage('Hello, world!'); * Sentry.captureException(new Error('Good bye')); * Sentry.captureEvent({ * message: 'Manual', * stacktrace: [ * // ... * ], * }); * ``` * * @see {@link BrowserOptions} for documentation on configuration options. */ function init(options = {}) { if (options.defaultIntegrations === undefined) { options.defaultIntegrations = defaultIntegrations; } if (options.release === undefined) { var window = (0,esm_global/* getGlobalObject */.R)(); // This supports the variable that sentry-webpack-plugin injects if (window.SENTRY_RELEASE && window.SENTRY_RELEASE.id) { options.release = window.SENTRY_RELEASE.id; } } if (options.autoSessionTracking === undefined) { options.autoSessionTracking = true; } if (options.sendClientReports === undefined) { options.sendClientReports = true; } var clientOptions = { ...options, stackParser: (0,stacktrace/* stackParserFromStackParserOptions */.Sq)(options.stackParser || defaultStackParser), integrations: getIntegrationsToSetup(options), transport: options.transport || ((0,supports/* supportsFetch */.Ak)() ? makeFetchTransport : makeXHRTransport), }; initAndBind(BrowserClient, clientOptions); if (options.autoSessionTracking) { startSessionTracking(); } } /** * Present the user with a report dialog. * * @param options Everything is optional, we try to fetch all info need from the global scope. */ function showReportDialog(options = {}, hub = (0,esm_hub/* getCurrentHub */.Gd)()) { // doesn't work without a document (React Native) var global = (0,esm_global/* getGlobalObject */.R)(); if (!global.document) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && esm_logger/* logger.error */.kg.error('Global document not defined in showReportDialog call'); return; } const { client, scope } = hub.getStackTop(); var dsn = options.dsn || (client && client.getDsn()); if (!dsn) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && esm_logger/* logger.error */.kg.error('DSN not configured for showReportDialog call'); return; } if (scope) { options.user = { ...scope.getUser(), ...options.user, }; } if (!options.eventId) { options.eventId = hub.lastEventId(); } var script = global.document.createElement('script'); script.async = true; script.src = getReportDialogEndpoint(dsn, options); if (options.onLoad) { script.onload = options.onLoad; } var injectionPoint = global.document.head || global.document.body; if (injectionPoint) { injectionPoint.appendChild(script); } else { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && esm_logger/* logger.error */.kg.error('Not injecting report dialog. No injection point found in HTML'); } } /** * This is the getter for lastEventId. * * @returns The last event id of a captured event. */ function lastEventId() { return getCurrentHub().lastEventId(); } /** * This function is here to be API compatible with the loader. * @hidden */ function forceLoad() { // Noop } /** * This function is here to be API compatible with the loader. * @hidden */ function onLoad(callback) { callback(); } /** * Call `flush()` on the current client, if there is one. See {@link Client.flush}. * * @param timeout Maximum time in ms the client should wait to flush its event queue. Omitting this parameter will cause * the client to wait until all events are sent before resolving the promise. * @returns A promise which resolves to `true` if the queue successfully drains before the timeout, or `false` if it * doesn't (or if there's no client defined). */ function flush(timeout) { var client = getCurrentHub().getClient(); if (client) { return client.flush(timeout); } (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && logger.warn('Cannot flush events. No client defined.'); return resolvedSyncPromise(false); } /** * Call `close()` on the current client, if there is one. See {@link Client.close}. * * @param timeout Maximum time in ms the client should wait to flush its event queue before shutting down. Omitting this * parameter will cause the client to wait until all events are sent before disabling itself. * @returns A promise which resolves to `true` if the queue successfully drains before the timeout, or `false` if it * doesn't (or if there's no client defined). */ function sdk_close(timeout) { var client = getCurrentHub().getClient(); if (client) { return client.close(timeout); } (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && logger.warn('Cannot flush events and disable SDK. No client defined.'); return resolvedSyncPromise(false); } /** * Wrap code within a try/catch block so the SDK is able to capture errors. * * @param fn A function to wrap. * * @returns The result of wrapped function call. */ function wrap(fn) { return wrap$1(fn)(); } function startSessionOnHub(hub) { hub.startSession({ ignoreDuration: true }); hub.captureSession(); } /** * Enable automatic Session Tracking for the initial page load. */ function startSessionTracking() { var window = (0,esm_global/* getGlobalObject */.R)(); var document = window.document; if (typeof document === 'undefined') { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && esm_logger/* logger.warn */.kg.warn('Session tracking in non-browser environment with @sentry/browser is not supported.'); return; } var hub = (0,esm_hub/* getCurrentHub */.Gd)(); // The only way for this to be false is for there to be a version mismatch between @sentry/browser (>= 6.0.0) and // @sentry/hub (< 5.27.0). In the simple case, there won't ever be such a mismatch, because the two packages are // pinned at the same version in package.json, but there are edge cases where it's possible. See // https://github.com/getsentry/sentry-javascript/issues/3207 and // https://github.com/getsentry/sentry-javascript/issues/3234 and // https://github.com/getsentry/sentry-javascript/issues/3278. if (!hub.captureSession) { return; } // The session duration for browser sessions does not track a meaningful // concept that can be used as a metric. // Automatically captured sessions are akin to page views, and thus we // discard their duration. startSessionOnHub(hub); // We want to create a session for every navigation as well (0,instrument/* addInstrumentationHandler */.o)('history', ({ from, to }) => { // Don't create an additional session for the initial route or if the location did not change if (!(from === undefined || from === to)) { startSessionOnHub((0,esm_hub/* getCurrentHub */.Gd)()); } }); } //# sourceMappingURL=sdk.js.map /***/ }), /***/ 19116: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "c": function() { return /* binding */ FunctionToString; } /* harmony export */ }); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20535); let originalFunctionToString; /** Patch toString calls to return proper name for wrapped functions */ class FunctionToString {constructor() { FunctionToString.prototype.__init.call(this); } /** * @inheritDoc */ static __initStatic() {this.id = 'FunctionToString';} /** * @inheritDoc */ __init() {this.name = FunctionToString.id;} /** * @inheritDoc */ setupOnce() { originalFunctionToString = Function.prototype.toString; Function.prototype.toString = function ( ...args) { var context = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__/* .getOriginalFunction */ .HK)(this) || this; return originalFunctionToString.apply(context, args); }; } } FunctionToString.__initStatic(); //# sourceMappingURL=functiontostring.js.map /***/ }), /***/ 42422: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "QD": function() { return /* binding */ InboundFilters; } /* harmony export */ }); /* unused harmony exports _mergeOptions, _shouldDropEvent */ /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(12343); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(62844); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(57321); // "Script error." is hard coded into browsers for errors that it can't read. // this is the result of a script being pulled in from an external domain and CORS. var DEFAULT_IGNORE_ERRORS = [/^Script error\.?$/, /^Javascript error: Script error\.? on line 0$/]; /** Options for the InboundFilters integration */ /** Inbound filters configurable by the user */ class InboundFilters { /** * @inheritDoc */ static __initStatic() {this.id = 'InboundFilters';} /** * @inheritDoc */ __init() {this.name = InboundFilters.id;} constructor( _options = {}) {;this._options = _options;InboundFilters.prototype.__init.call(this);} /** * @inheritDoc */ setupOnce(addGlobalEventProcessor, getCurrentHub) { var eventProcess = (event) => { var hub = getCurrentHub(); if (hub) { var self = hub.getIntegration(InboundFilters); if (self) { var client = hub.getClient(); var clientOptions = client ? client.getOptions() : {}; var options = _mergeOptions(self._options, clientOptions); return _shouldDropEvent(event, options) ? null : event; } } return event; }; eventProcess.id = this.name; addGlobalEventProcessor(eventProcess); } } InboundFilters.__initStatic(); /** JSDoc */ function _mergeOptions( internalOptions = {}, clientOptions = {}, ) { return { allowUrls: [...(internalOptions.allowUrls || []), ...(clientOptions.allowUrls || [])], denyUrls: [...(internalOptions.denyUrls || []), ...(clientOptions.denyUrls || [])], ignoreErrors: [ ...(internalOptions.ignoreErrors || []), ...(clientOptions.ignoreErrors || []), ...DEFAULT_IGNORE_ERRORS, ], ignoreInternal: internalOptions.ignoreInternal !== undefined ? internalOptions.ignoreInternal : true, }; } /** JSDoc */ function _shouldDropEvent(event, options) { if (options.ignoreInternal && _isSentryError(event)) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_0__/* .logger.warn */ .kg.warn(`Event dropped due to being internal Sentry Error.\nEvent: ${(0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__/* .getEventDescription */ .jH)(event)}`); return true; } if (_isIgnoredError(event, options.ignoreErrors)) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_0__/* .logger.warn */ .kg.warn( `Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${(0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__/* .getEventDescription */ .jH)(event)}`, ); return true; } if (_isDeniedUrl(event, options.denyUrls)) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_0__/* .logger.warn */ .kg.warn( `Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${(0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__/* .getEventDescription */ .jH)( event, )}.\nUrl: ${_getEventFilterUrl(event)}`, ); return true; } if (!_isAllowedUrl(event, options.allowUrls)) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_0__/* .logger.warn */ .kg.warn( `Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${(0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__/* .getEventDescription */ .jH)( event, )}.\nUrl: ${_getEventFilterUrl(event)}`, ); return true; } return false; } function _isIgnoredError(event, ignoreErrors) { if (!ignoreErrors || !ignoreErrors.length) { return false; } return _getPossibleEventMessages(event).some(message => ignoreErrors.some(pattern => (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_2__/* .isMatchingPattern */ .zC)(message, pattern)), ); } function _isDeniedUrl(event, denyUrls) { // TODO: Use Glob instead? if (!denyUrls || !denyUrls.length) { return false; } var url = _getEventFilterUrl(event); return !url ? false : denyUrls.some(pattern => (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_2__/* .isMatchingPattern */ .zC)(url, pattern)); } function _isAllowedUrl(event, allowUrls) { // TODO: Use Glob instead? if (!allowUrls || !allowUrls.length) { return true; } var url = _getEventFilterUrl(event); return !url ? true : allowUrls.some(pattern => (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_2__/* .isMatchingPattern */ .zC)(url, pattern)); } function _getPossibleEventMessages(event) { if (event.message) { return [event.message]; } if (event.exception) { try { const { type = '', value = '' } = (event.exception.values && event.exception.values[0]) || {}; return [`${value}`, `${type}: ${value}`]; } catch (oO) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_0__/* .logger.error */ .kg.error(`Cannot extract message for event ${(0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__/* .getEventDescription */ .jH)(event)}`); return []; } } return []; } function _isSentryError(event) { try { // @ts-ignore can't be a sentry error if undefined return event.exception.values[0].type === 'SentryError'; } catch (e) { // ignore } return false; } function _getLastValidUrl(frames = []) { for (let i = frames.length - 1; i >= 0; i--) { var frame = frames[i]; if (frame && frame.filename !== '' && frame.filename !== '[native code]') { return frame.filename || null; } } return null; } function _getEventFilterUrl(event) { try { let frames; try { // @ts-ignore we only care about frames if the whole thing here is defined frames = event.exception.values[0].stacktrace.frames; } catch (e) { // ignore } return frames ? _getLastValidUrl(frames) : null; } catch (oO) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_0__/* .logger.error */ .kg.error(`Cannot extract url for event ${(0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__/* .getEventDescription */ .jH)(event)}`); return null; } } //# sourceMappingURL=inboundfilters.js.map /***/ }), /***/ 40105: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "J": function() { return /* binding */ SDK_VERSION; } /* harmony export */ }); var SDK_VERSION = '7.11.0'; //# sourceMappingURL=version.js.map /***/ }), /***/ 92876: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "$e": function() { return /* binding */ withScope; }, /* harmony export */ "Tb": function() { return /* binding */ captureException; }, /* harmony export */ "av": function() { return /* binding */ setUser; }, /* harmony export */ "e": function() { return /* binding */ configureScope; }, /* harmony export */ "n_": function() { return /* binding */ addBreadcrumb; } /* harmony export */ }); /* unused harmony exports captureEvent, captureMessage, setContext, setExtra, setExtras, setTag, setTags, startTransaction */ /* harmony import */ var _hub_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(38641); // Note: All functions in this file are typed with a return value of `ReturnType`, // where HUB_FUNCTION is some method on the Hub class. // // This is done to make sure the top level SDK methods stay in sync with the hub methods. // Although every method here has an explicit return type, some of them (that map to void returns) do not // contain `return` keywords. This is done to save on bundle size, as `return` is not minifiable. /** * Captures an exception event and sends it to Sentry. * * @param exception An exception-like object. * @param captureContext Additional scope data to apply to exception event. * @returns The generated eventId. */ function captureException(exception, captureContext) { return (0,_hub_js__WEBPACK_IMPORTED_MODULE_0__/* .getCurrentHub */ .Gd)().captureException(exception, { captureContext }); } /** * Captures a message event and sends it to Sentry. * * @param message The message to send to Sentry. * @param Severity Define the level of the message. * @returns The generated eventId. */ function captureMessage( message, captureContext, ) { // This is necessary to provide explicit scopes upgrade, without changing the original // arity of the `captureMessage(message, level)` method. var level = typeof captureContext === 'string' ? captureContext : undefined; var context = typeof captureContext !== 'string' ? { captureContext } : undefined; return getCurrentHub().captureMessage(message, level, context); } /** * Captures a manually created event and sends it to Sentry. * * @param event The event to send to Sentry. * @returns The generated eventId. */ function captureEvent(event, hint) { return getCurrentHub().captureEvent(event, hint); } /** * Callback to set context information onto the scope. * @param callback Callback function that receives Scope. */ function configureScope(callback) { (0,_hub_js__WEBPACK_IMPORTED_MODULE_0__/* .getCurrentHub */ .Gd)().configureScope(callback); } /** * Records a new breadcrumb which will be attached to future events. * * Breadcrumbs will be added to subsequent events to provide more context on * user's actions prior to an error or crash. * * @param breadcrumb The breadcrumb to record. */ function addBreadcrumb(breadcrumb) { (0,_hub_js__WEBPACK_IMPORTED_MODULE_0__/* .getCurrentHub */ .Gd)().addBreadcrumb(breadcrumb); } /** * Sets context data with the given name. * @param name of the context * @param context Any kind of data. This data will be normalized. */ function setContext(name, context) { getCurrentHub().setContext(name, context); } /** * Set an object that will be merged sent as extra data with the event. * @param extras Extras object to merge into current context. */ function setExtras(extras) { getCurrentHub().setExtras(extras); } /** * Set key:value that will be sent as extra data with the event. * @param key String of extra * @param extra Any kind of data. This data will be normalized. */ function setExtra(key, extra) { getCurrentHub().setExtra(key, extra); } /** * Set an object that will be merged sent as tags data with the event. * @param tags Tags context object to merge into current context. */ function setTags(tags) { getCurrentHub().setTags(tags); } /** * Set key:value that will be sent as tags data with the event. * * Can also be used to unset a tag, by passing `undefined`. * * @param key String key of tag * @param value Value of tag */ function setTag(key, value) { getCurrentHub().setTag(key, value); } /** * Updates user context information for future events. * * @param user User context object to be set in the current context. Pass `null` to unset the user. */ function setUser(user) { (0,_hub_js__WEBPACK_IMPORTED_MODULE_0__/* .getCurrentHub */ .Gd)().setUser(user); } /** * Creates a new scope with and executes the given operation within. * The scope is automatically removed once the operation * finishes or throws. * * This is essentially a convenience function for: * * pushScope(); * callback(); * popScope(); * * @param callback that will be enclosed into push/popScope. */ function withScope(callback) { (0,_hub_js__WEBPACK_IMPORTED_MODULE_0__/* .getCurrentHub */ .Gd)().withScope(callback); } /** * Starts a new `Transaction` and returns it. This is the entry point to manual tracing instrumentation. * * A tree structure can be built by adding child spans to the transaction, and child spans to other spans. To start a * new child span within the transaction or any span, call the respective `.startChild()` method. * * Every child span must be finished before the transaction is finished, otherwise the unfinished spans are discarded. * * The transaction must be finished with a call to its `.finish()` method, at which point the transaction with all its * finished child spans will be sent to Sentry. * * NOTE: This function should only be used for *manual* instrumentation. Auto-instrumentation should call * `startTransaction` directly on the hub. * * @param context Properties of the new `Transaction`. * @param customSamplingContext Information given to the transaction sampling function (along with context-dependent * default values). See {@link Options.tracesSampler}. * * @returns The transaction which was just started */ function startTransaction( context, customSamplingContext, ) { return getCurrentHub().startTransaction( { metadata: { source: 'custom' }, ...context, }, customSamplingContext, ); } //# sourceMappingURL=exports.js.map /***/ }), /***/ 38641: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Gd": function() { return /* binding */ getCurrentHub; }, /* harmony export */ "cu": function() { return /* binding */ getMainCarrier; } /* harmony export */ }); /* unused harmony exports API_VERSION, Hub, getHubFromCarrier, makeMain, setHubOnCarrier */ /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(62844); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(21170); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(12343); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(82991); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(92448); /* harmony import */ var _scope_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(46769); /* harmony import */ var _session_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(95771); /** * API compatibility version of this hub. * * WARNING: This number should only be increased when the global interface * changes and new methods are introduced. * * @hidden */ var API_VERSION = 4; /** * Default maximum number of breadcrumbs added to an event. Can be overwritten * with {@link Options.maxBreadcrumbs}. */ var DEFAULT_BREADCRUMBS = 100; /** * A layer in the process stack. * @hidden */ /** * @inheritDoc */ class Hub { /** Is a {@link Layer}[] containing the client and scope */ __init() {this._stack = [{}];} /** Contains the last event id of a captured event. */ /** * Creates a new instance of the hub, will push one {@link Layer} into the * internal stack on creation. * * @param client bound to the hub. * @param scope bound to the hub. * @param version number, higher number means higher priority. */ constructor(client, scope = new _scope_js__WEBPACK_IMPORTED_MODULE_0__/* .Scope */ .s(), _version = API_VERSION) {;this._version = _version;Hub.prototype.__init.call(this); this.getStackTop().scope = scope; if (client) { this.bindClient(client); } } /** * @inheritDoc */ isOlderThan(version) { return this._version < version; } /** * @inheritDoc */ bindClient(client) { var top = this.getStackTop(); top.client = client; if (client && client.setupIntegrations) { client.setupIntegrations(); } } /** * @inheritDoc */ pushScope() { // We want to clone the content of prev scope var scope = _scope_js__WEBPACK_IMPORTED_MODULE_0__/* .Scope.clone */ .s.clone(this.getScope()); this.getStack().push({ client: this.getClient(), scope, }); return scope; } /** * @inheritDoc */ popScope() { if (this.getStack().length <= 1) return false; return !!this.getStack().pop(); } /** * @inheritDoc */ withScope(callback) { var scope = this.pushScope(); try { callback(scope); } finally { this.popScope(); } } /** * @inheritDoc */ getClient() { return this.getStackTop().client ; } /** Returns the scope of the top stack. */ getScope() { return this.getStackTop().scope; } /** Returns the scope stack for domains or the process. */ getStack() { return this._stack; } /** Returns the topmost scope layer in the order domain > local > process. */ getStackTop() { return this._stack[this._stack.length - 1]; } /** * @inheritDoc */ captureException(exception, hint) { var eventId = (this._lastEventId = hint && hint.event_id ? hint.event_id : (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__/* .uuid4 */ .DM)()); var syntheticException = new Error('Sentry syntheticException'); this._withClient((client, scope) => { client.captureException( exception, { originalException: exception, syntheticException, ...hint, event_id: eventId, }, scope, ); }); return eventId; } /** * @inheritDoc */ captureMessage( message, level, hint, ) { var eventId = (this._lastEventId = hint && hint.event_id ? hint.event_id : (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__/* .uuid4 */ .DM)()); var syntheticException = new Error(message); this._withClient((client, scope) => { client.captureMessage( message, level, { originalException: message, syntheticException, ...hint, event_id: eventId, }, scope, ); }); return eventId; } /** * @inheritDoc */ captureEvent(event, hint) { var eventId = hint && hint.event_id ? hint.event_id : (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__/* .uuid4 */ .DM)(); if (event.type !== 'transaction') { this._lastEventId = eventId; } this._withClient((client, scope) => { client.captureEvent(event, { ...hint, event_id: eventId }, scope); }); return eventId; } /** * @inheritDoc */ lastEventId() { return this._lastEventId; } /** * @inheritDoc */ addBreadcrumb(breadcrumb, hint) { const { scope, client } = this.getStackTop(); if (!scope || !client) return; const { beforeBreadcrumb = null, maxBreadcrumbs = DEFAULT_BREADCRUMBS } = (client.getOptions && client.getOptions()) || {}; if (maxBreadcrumbs <= 0) return; var timestamp = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_2__/* .dateTimestampInSeconds */ .yW)(); var mergedBreadcrumb = { timestamp, ...breadcrumb }; var finalBreadcrumb = beforeBreadcrumb ? ((0,_sentry_utils__WEBPACK_IMPORTED_MODULE_3__/* .consoleSandbox */ .Cf)(() => beforeBreadcrumb(mergedBreadcrumb, hint)) ) : mergedBreadcrumb; if (finalBreadcrumb === null) return; scope.addBreadcrumb(finalBreadcrumb, maxBreadcrumbs); } /** * @inheritDoc */ setUser(user) { var scope = this.getScope(); if (scope) scope.setUser(user); } /** * @inheritDoc */ setTags(tags) { var scope = this.getScope(); if (scope) scope.setTags(tags); } /** * @inheritDoc */ setExtras(extras) { var scope = this.getScope(); if (scope) scope.setExtras(extras); } /** * @inheritDoc */ setTag(key, value) { var scope = this.getScope(); if (scope) scope.setTag(key, value); } /** * @inheritDoc */ setExtra(key, extra) { var scope = this.getScope(); if (scope) scope.setExtra(key, extra); } /** * @inheritDoc */ setContext(name, context) { var scope = this.getScope(); if (scope) scope.setContext(name, context); } /** * @inheritDoc */ configureScope(callback) { const { scope, client } = this.getStackTop(); if (scope && client) { callback(scope); } } /** * @inheritDoc */ run(callback) { var oldHub = makeMain(this); try { callback(this); } finally { makeMain(oldHub); } } /** * @inheritDoc */ getIntegration(integration) { var client = this.getClient(); if (!client) return null; try { return client.getIntegration(integration); } catch (_oO) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_3__/* .logger.warn */ .kg.warn(`Cannot retrieve integration ${integration.id} from the current Hub`); return null; } } /** * @inheritDoc */ startTransaction(context, customSamplingContext) { return this._callExtensionMethod('startTransaction', context, customSamplingContext); } /** * @inheritDoc */ traceHeaders() { return this._callExtensionMethod('traceHeaders'); } /** * @inheritDoc */ captureSession(endSession = false) { // both send the update and pull the session from the scope if (endSession) { return this.endSession(); } // only send the update this._sendSessionUpdate(); } /** * @inheritDoc */ endSession() { var layer = this.getStackTop(); var scope = layer && layer.scope; var session = scope && scope.getSession(); if (session) { (0,_session_js__WEBPACK_IMPORTED_MODULE_4__/* .closeSession */ .RJ)(session); } this._sendSessionUpdate(); // the session is over; take it off of the scope if (scope) { scope.setSession(); } } /** * @inheritDoc */ startSession(context) { const { scope, client } = this.getStackTop(); const { release, environment } = (client && client.getOptions()) || {}; // Will fetch userAgent if called from browser sdk var global = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_5__/* .getGlobalObject */ .R)(); const { userAgent } = global.navigator || {}; var session = (0,_session_js__WEBPACK_IMPORTED_MODULE_4__/* .makeSession */ .Hv)({ release, environment, ...(scope && { user: scope.getUser() }), ...(userAgent && { userAgent }), ...context, }); if (scope) { // End existing session if there's one var currentSession = scope.getSession && scope.getSession(); if (currentSession && currentSession.status === 'ok') { (0,_session_js__WEBPACK_IMPORTED_MODULE_4__/* .updateSession */ .CT)(currentSession, { status: 'exited' }); } this.endSession(); // Afterwards we set the new session on the scope scope.setSession(session); } return session; } /** * Returns if default PII should be sent to Sentry and propagated in ourgoing requests * when Tracing is used. */ shouldSendDefaultPii() { var client = this.getClient(); var options = client && client.getOptions(); return Boolean(options && options.sendDefaultPii); } /** * Sends the current Session on the scope */ _sendSessionUpdate() { const { scope, client } = this.getStackTop(); if (!scope) return; var session = scope.getSession(); if (session) { if (client && client.captureSession) { client.captureSession(session); } } } /** * Internal helper function to call a method on the top client if it exists. * * @param method The method to call on the client. * @param args Arguments to pass to the client function. */ _withClient(callback) { const { scope, client } = this.getStackTop(); if (client) { callback(client, scope); } } /** * Calls global extension method and binding current instance to the function call */ // @ts-ignore Function lacks ending return statement and return type does not include 'undefined'. ts(2366) _callExtensionMethod(method, ...args) { var carrier = getMainCarrier(); var sentry = carrier.__SENTRY__; if (sentry && sentry.extensions && typeof sentry.extensions[method] === 'function') { return sentry.extensions[method].apply(this, args); } (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_3__/* .logger.warn */ .kg.warn(`Extension method ${method} couldn't be found, doing nothing.`); } } /** * Returns the global shim registry. * * FIXME: This function is problematic, because despite always returning a valid Carrier, * it has an optional `__SENTRY__` property, which then in turn requires us to always perform an unnecessary check * at the call-site. We always access the carrier through this function, so we can guarantee that `__SENTRY__` is there. **/ function getMainCarrier() { var carrier = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_5__/* .getGlobalObject */ .R)(); carrier.__SENTRY__ = carrier.__SENTRY__ || { extensions: {}, hub: undefined, }; return carrier; } /** * Replaces the current main hub with the passed one on the global object * * @returns The old replaced hub */ function makeMain(hub) { var registry = getMainCarrier(); var oldHub = getHubFromCarrier(registry); setHubOnCarrier(registry, hub); return oldHub; } /** * Returns the default hub instance. * * If a hub is already registered in the global carrier but this module * contains a more recent version, it replaces the registered version. * Otherwise, the currently registered hub will be returned. */ function getCurrentHub() { // Get main carrier (global for every environment) var registry = getMainCarrier(); // If there's no hub, or its an old API, assign a new one if (!hasHubOnCarrier(registry) || getHubFromCarrier(registry).isOlderThan(API_VERSION)) { setHubOnCarrier(registry, new Hub()); } // Prefer domains over global if they are there (applicable only to Node environment) if ((0,_sentry_utils__WEBPACK_IMPORTED_MODULE_6__/* .isNodeEnv */ .KV)()) { return getHubFromActiveDomain(registry); } // Return hub that lives on a global object return getHubFromCarrier(registry); } /** * Try to read the hub from an active domain, and fallback to the registry if one doesn't exist * @returns discovered hub */ function getHubFromActiveDomain(registry) { try { var sentry = getMainCarrier().__SENTRY__; var activeDomain = sentry && sentry.extensions && sentry.extensions.domain && sentry.extensions.domain.active; // If there's no active domain, just return global hub if (!activeDomain) { return getHubFromCarrier(registry); } // If there's no hub on current domain, or it's an old API, assign a new one if (!hasHubOnCarrier(activeDomain) || getHubFromCarrier(activeDomain).isOlderThan(API_VERSION)) { var registryHubTopStack = getHubFromCarrier(registry).getStackTop(); setHubOnCarrier(activeDomain, new Hub(registryHubTopStack.client, _scope_js__WEBPACK_IMPORTED_MODULE_0__/* .Scope.clone */ .s.clone(registryHubTopStack.scope))); } // Return hub that lives on a domain return getHubFromCarrier(activeDomain); } catch (_Oo) { // Return hub that lives on a global object return getHubFromCarrier(registry); } } /** * This will tell whether a carrier has a hub on it or not * @param carrier object */ function hasHubOnCarrier(carrier) { return !!(carrier && carrier.__SENTRY__ && carrier.__SENTRY__.hub); } /** * This will create a new {@link Hub} and add to the passed object on * __SENTRY__.hub. * @param carrier object * @hidden */ function getHubFromCarrier(carrier) { return (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_5__/* .getGlobalSingleton */ .Y)('hub', () => new Hub(), carrier); } /** * This will set passed {@link Hub} on the passed object's __SENTRY__.hub attribute * @param carrier object * @param hub Hub * @returns A boolean indicating success or failure */ function setHubOnCarrier(carrier, hub) { if (!carrier) return false; var __SENTRY__ = (carrier.__SENTRY__ = carrier.__SENTRY__ || {}); __SENTRY__.hub = hub; return true; } //# sourceMappingURL=hub.js.map /***/ }), /***/ 46769: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "c": function() { return /* binding */ addGlobalEventProcessor; }, /* harmony export */ "s": function() { return /* binding */ Scope; } /* harmony export */ }); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67597); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(21170); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(96893); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(12343); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(82991); /* harmony import */ var _session_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(95771); /** * Absolute maximum number of breadcrumbs added to an event. * The `maxBreadcrumbs` option cannot be higher than this value. */ var MAX_BREADCRUMBS = 100; /** * Holds additional event information. {@link Scope.applyToEvent} will be * called by the client before an event will be sent. */ class Scope { /** Flag if notifying is happening. */ /** Callback for client to receive scope changes. */ /** Callback list that will be called after {@link applyToEvent}. */ /** Array of breadcrumbs. */ /** User */ /** Tags */ /** Extra */ /** Contexts */ /** Attachments */ /** * A place to stash data which is needed at some point in the SDK's event processing pipeline but which shouldn't get * sent to Sentry */ /** Fingerprint */ /** Severity */ /** Transaction Name */ /** Span */ /** Session */ /** Request Mode Session Status */ constructor() { this._notifyingListeners = false; this._scopeListeners = []; this._eventProcessors = []; this._breadcrumbs = []; this._attachments = []; this._user = {}; this._tags = {}; this._extra = {}; this._contexts = {}; this._sdkProcessingMetadata = {}; } /** * Inherit values from the parent scope. * @param scope to clone. */ static clone(scope) { var newScope = new Scope(); if (scope) { newScope._breadcrumbs = [...scope._breadcrumbs]; newScope._tags = { ...scope._tags }; newScope._extra = { ...scope._extra }; newScope._contexts = { ...scope._contexts }; newScope._user = scope._user; newScope._level = scope._level; newScope._span = scope._span; newScope._session = scope._session; newScope._transactionName = scope._transactionName; newScope._fingerprint = scope._fingerprint; newScope._eventProcessors = [...scope._eventProcessors]; newScope._requestSession = scope._requestSession; newScope._attachments = [...scope._attachments]; } return newScope; } /** * Add internal on change listener. Used for sub SDKs that need to store the scope. * @hidden */ addScopeListener(callback) { this._scopeListeners.push(callback); } /** * @inheritDoc */ addEventProcessor(callback) { this._eventProcessors.push(callback); return this; } /** * @inheritDoc */ setUser(user) { this._user = user || {}; if (this._session) { (0,_session_js__WEBPACK_IMPORTED_MODULE_0__/* .updateSession */ .CT)(this._session, { user }); } this._notifyScopeListeners(); return this; } /** * @inheritDoc */ getUser() { return this._user; } /** * @inheritDoc */ getRequestSession() { return this._requestSession; } /** * @inheritDoc */ setRequestSession(requestSession) { this._requestSession = requestSession; return this; } /** * @inheritDoc */ setTags(tags) { this._tags = { ...this._tags, ...tags, }; this._notifyScopeListeners(); return this; } /** * @inheritDoc */ setTag(key, value) { this._tags = { ...this._tags, [key]: value }; this._notifyScopeListeners(); return this; } /** * @inheritDoc */ setExtras(extras) { this._extra = { ...this._extra, ...extras, }; this._notifyScopeListeners(); return this; } /** * @inheritDoc */ setExtra(key, extra) { this._extra = { ...this._extra, [key]: extra }; this._notifyScopeListeners(); return this; } /** * @inheritDoc */ setFingerprint(fingerprint) { this._fingerprint = fingerprint; this._notifyScopeListeners(); return this; } /** * @inheritDoc */ setLevel( level, ) { this._level = level; this._notifyScopeListeners(); return this; } /** * @inheritDoc */ setTransactionName(name) { this._transactionName = name; this._notifyScopeListeners(); return this; } /** * @inheritDoc */ setContext(key, context) { if (context === null) { delete this._contexts[key]; } else { this._contexts = { ...this._contexts, [key]: context }; } this._notifyScopeListeners(); return this; } /** * @inheritDoc */ setSpan(span) { this._span = span; this._notifyScopeListeners(); return this; } /** * @inheritDoc */ getSpan() { return this._span; } /** * @inheritDoc */ getTransaction() { // Often, this span (if it exists at all) will be a transaction, but it's not guaranteed to be. Regardless, it will // have a pointer to the currently-active transaction. var span = this.getSpan(); return span && span.transaction; } /** * @inheritDoc */ setSession(session) { if (!session) { delete this._session; } else { this._session = session; } this._notifyScopeListeners(); return this; } /** * @inheritDoc */ getSession() { return this._session; } /** * @inheritDoc */ update(captureContext) { if (!captureContext) { return this; } if (typeof captureContext === 'function') { var updatedScope = (captureContext )(this); return updatedScope instanceof Scope ? updatedScope : this; } if (captureContext instanceof Scope) { this._tags = { ...this._tags, ...captureContext._tags }; this._extra = { ...this._extra, ...captureContext._extra }; this._contexts = { ...this._contexts, ...captureContext._contexts }; if (captureContext._user && Object.keys(captureContext._user).length) { this._user = captureContext._user; } if (captureContext._level) { this._level = captureContext._level; } if (captureContext._fingerprint) { this._fingerprint = captureContext._fingerprint; } if (captureContext._requestSession) { this._requestSession = captureContext._requestSession; } } else if ((0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__/* .isPlainObject */ .PO)(captureContext)) { captureContext = captureContext ; this._tags = { ...this._tags, ...captureContext.tags }; this._extra = { ...this._extra, ...captureContext.extra }; this._contexts = { ...this._contexts, ...captureContext.contexts }; if (captureContext.user) { this._user = captureContext.user; } if (captureContext.level) { this._level = captureContext.level; } if (captureContext.fingerprint) { this._fingerprint = captureContext.fingerprint; } if (captureContext.requestSession) { this._requestSession = captureContext.requestSession; } } return this; } /** * @inheritDoc */ clear() { this._breadcrumbs = []; this._tags = {}; this._extra = {}; this._user = {}; this._contexts = {}; this._level = undefined; this._transactionName = undefined; this._fingerprint = undefined; this._requestSession = undefined; this._span = undefined; this._session = undefined; this._notifyScopeListeners(); this._attachments = []; return this; } /** * @inheritDoc */ addBreadcrumb(breadcrumb, maxBreadcrumbs) { var maxCrumbs = typeof maxBreadcrumbs === 'number' ? Math.min(maxBreadcrumbs, MAX_BREADCRUMBS) : MAX_BREADCRUMBS; // No data has been changed, so don't notify scope listeners if (maxCrumbs <= 0) { return this; } var mergedBreadcrumb = { timestamp: (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_2__/* .dateTimestampInSeconds */ .yW)(), ...breadcrumb, }; this._breadcrumbs = [...this._breadcrumbs, mergedBreadcrumb].slice(-maxCrumbs); this._notifyScopeListeners(); return this; } /** * @inheritDoc */ clearBreadcrumbs() { this._breadcrumbs = []; this._notifyScopeListeners(); return this; } /** * @inheritDoc */ addAttachment(attachment) { this._attachments.push(attachment); return this; } /** * @inheritDoc */ getAttachments() { return this._attachments; } /** * @inheritDoc */ clearAttachments() { this._attachments = []; return this; } /** * Applies the current context and fingerprint to the event. * Note that breadcrumbs will be added by the client. * Also if the event has already breadcrumbs on it, we do not merge them. * @param event Event * @param hint May contain additional information about the original exception. * @hidden */ applyToEvent(event, hint = {}) { if (this._extra && Object.keys(this._extra).length) { event.extra = { ...this._extra, ...event.extra }; } if (this._tags && Object.keys(this._tags).length) { event.tags = { ...this._tags, ...event.tags }; } if (this._user && Object.keys(this._user).length) { event.user = { ...this._user, ...event.user }; } if (this._contexts && Object.keys(this._contexts).length) { event.contexts = { ...this._contexts, ...event.contexts }; } if (this._level) { event.level = this._level; } if (this._transactionName) { event.transaction = this._transactionName; } // We want to set the trace context for normal events only if there isn't already // a trace context on the event. There is a product feature in place where we link // errors with transaction and it relies on that. if (this._span) { event.contexts = { trace: this._span.getTraceContext(), ...event.contexts }; var transactionName = this._span.transaction && this._span.transaction.name; if (transactionName) { event.tags = { transaction: transactionName, ...event.tags }; } } this._applyFingerprint(event); event.breadcrumbs = [...(event.breadcrumbs || []), ...this._breadcrumbs]; event.breadcrumbs = event.breadcrumbs.length > 0 ? event.breadcrumbs : undefined; event.sdkProcessingMetadata = { ...event.sdkProcessingMetadata, ...this._sdkProcessingMetadata }; return this._notifyEventProcessors([...getGlobalEventProcessors(), ...this._eventProcessors], event, hint); } /** * Add data which will be accessible during event processing but won't get sent to Sentry */ setSDKProcessingMetadata(newData) { this._sdkProcessingMetadata = { ...this._sdkProcessingMetadata, ...newData }; return this; } /** * This will be called after {@link applyToEvent} is finished. */ _notifyEventProcessors( processors, event, hint, index = 0, ) { return new _sentry_utils__WEBPACK_IMPORTED_MODULE_3__/* .SyncPromise */ .cW((resolve, reject) => { var processor = processors[index]; if (event === null || typeof processor !== 'function') { resolve(event); } else { var result = processor({ ...event }, hint) ; (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && processor.id && result === null && _sentry_utils__WEBPACK_IMPORTED_MODULE_4__/* .logger.log */ .kg.log(`Event processor "${processor.id}" dropped event`); if ((0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__/* .isThenable */ .J8)(result)) { void result .then(final => this._notifyEventProcessors(processors, final, hint, index + 1).then(resolve)) .then(null, reject); } else { void this._notifyEventProcessors(processors, result, hint, index + 1) .then(resolve) .then(null, reject); } } }); } /** * This will be called on every set call. */ _notifyScopeListeners() { // We need this check for this._notifyingListeners to be able to work on scope during updates // If this check is not here we'll produce endless recursion when something is done with the scope // during the callback. if (!this._notifyingListeners) { this._notifyingListeners = true; this._scopeListeners.forEach(callback => { callback(this); }); this._notifyingListeners = false; } } /** * Applies fingerprint from the scope to the event if there's one, * uses message if there's one instead or get rid of empty fingerprint */ _applyFingerprint(event) { // Make sure it's an array first and we actually have something in place event.fingerprint = event.fingerprint ? Array.isArray(event.fingerprint) ? event.fingerprint : [event.fingerprint] : []; // If we have something on the scope, then merge it with event if (this._fingerprint) { event.fingerprint = event.fingerprint.concat(this._fingerprint); } // If we have no data at all, remove empty array default if (event.fingerprint && !event.fingerprint.length) { delete event.fingerprint; } } } /** * Returns the global event processors. */ function getGlobalEventProcessors() { return (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_5__/* .getGlobalSingleton */ .Y)('globalEventProcessors', () => []); } /** * Add a EventProcessor to be kept globally. * @param callback EventProcessor to add */ function addGlobalEventProcessor(callback) { getGlobalEventProcessors().push(callback); } //# sourceMappingURL=scope.js.map /***/ }), /***/ 95771: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "CT": function() { return /* binding */ updateSession; }, /* harmony export */ "Hv": function() { return /* binding */ makeSession; }, /* harmony export */ "RJ": function() { return /* binding */ closeSession; } /* harmony export */ }); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(21170); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(62844); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(20535); /** * Creates a new `Session` object by setting certain default parameters. If optional @param context * is passed, the passed properties are applied to the session object. * * @param context (optional) additional properties to be applied to the returned session object * * @returns a new `Session` object */ function makeSession(context) { // Both timestamp and started are in seconds since the UNIX epoch. var startingTime = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__/* .timestampInSeconds */ .ph)(); var session = { sid: (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__/* .uuid4 */ .DM)(), init: true, timestamp: startingTime, started: startingTime, duration: 0, status: 'ok', errors: 0, ignoreDuration: false, toJSON: () => sessionToJSON(session), }; if (context) { updateSession(session, context); } return session; } /** * Updates a session object with the properties passed in the context. * * Note that this function mutates the passed object and returns void. * (Had to do this instead of returning a new and updated session because closing and sending a session * makes an update to the session after it was passed to the sending logic. * @see BaseClient.captureSession ) * * @param session the `Session` to update * @param context the `SessionContext` holding the properties that should be updated in @param session */ function updateSession(session, context = {}) { if (context.user) { if (!session.ipAddress && context.user.ip_address) { session.ipAddress = context.user.ip_address; } if (!session.did && !context.did) { session.did = context.user.id || context.user.email || context.user.username; } } session.timestamp = context.timestamp || (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__/* .timestampInSeconds */ .ph)(); if (context.ignoreDuration) { session.ignoreDuration = context.ignoreDuration; } if (context.sid) { // Good enough uuid validation. — Kamil session.sid = context.sid.length === 32 ? context.sid : (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__/* .uuid4 */ .DM)(); } if (context.init !== undefined) { session.init = context.init; } if (!session.did && context.did) { session.did = `${context.did}`; } if (typeof context.started === 'number') { session.started = context.started; } if (session.ignoreDuration) { session.duration = undefined; } else if (typeof context.duration === 'number') { session.duration = context.duration; } else { var duration = session.timestamp - session.started; session.duration = duration >= 0 ? duration : 0; } if (context.release) { session.release = context.release; } if (context.environment) { session.environment = context.environment; } if (!session.ipAddress && context.ipAddress) { session.ipAddress = context.ipAddress; } if (!session.userAgent && context.userAgent) { session.userAgent = context.userAgent; } if (typeof context.errors === 'number') { session.errors = context.errors; } if (context.status) { session.status = context.status; } } /** * Closes a session by setting its status and updating the session object with it. * Internally calls `updateSession` to update the passed session object. * * Note that this function mutates the passed session (@see updateSession for explanation). * * @param session the `Session` object to be closed * @param status the `SessionStatus` with which the session was closed. If you don't pass a status, * this function will keep the previously set status, unless it was `'ok'` in which case * it is changed to `'exited'`. */ function closeSession(session, status) { let context = {}; if (status) { context = { status }; } else if (session.status === 'ok') { context = { status: 'exited' }; } updateSession(session, context); } /** * Serializes a passed session object to a JSON object with a slightly different structure. * This is necessary because the Sentry backend requires a slightly different schema of a session * than the one the JS SDKs use internally. * * @param session the session to be converted * * @returns a JSON object of the passed session */ function sessionToJSON(session) { return (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_2__/* .dropUndefinedKeys */ .Jr)({ sid: `${session.sid}`, init: session.init, // Make sure that sec is converted to ms for date constructor started: new Date(session.started * 1000).toISOString(), timestamp: new Date(session.timestamp * 1000).toISOString(), status: session.status, errors: session.errors, did: typeof session.did === 'number' || typeof session.did === 'string' ? `${session.did}` : undefined, duration: session.duration, attrs: { release: session.release, environment: session.environment, ip_address: session.ipAddress, user_agent: session.userAgent, }, }); } //# sourceMappingURL=session.js.map /***/ }), /***/ 62758: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { "ro": function() { return /* binding */ addExtensionMethods; }, "lb": function() { return /* binding */ startIdleTransaction; } }); // UNUSED EXPORTS: _addTracingExtensions // EXTERNAL MODULE: ./node_modules/@sentry/hub/esm/hub.js var hub = __webpack_require__(38641); // EXTERNAL MODULE: ./node_modules/@sentry/utils/esm/logger.js var logger = __webpack_require__(12343); // EXTERNAL MODULE: ./node_modules/@sentry/utils/esm/is.js var is = __webpack_require__(67597); // EXTERNAL MODULE: ./node_modules/@sentry/utils/esm/node.js + 1 modules var node = __webpack_require__(92448); // EXTERNAL MODULE: ./node_modules/@sentry/utils/esm/instrument.js var instrument = __webpack_require__(9732); // EXTERNAL MODULE: ./node_modules/@sentry/tracing/esm/utils.js var utils = __webpack_require__(63233); ;// CONCATENATED MODULE: ./node_modules/@sentry/tracing/esm/errors.js /** * Configures global error listeners */ function registerErrorInstrumentation() { (0,instrument/* addInstrumentationHandler */.o)('error', errorCallback); (0,instrument/* addInstrumentationHandler */.o)('unhandledrejection', errorCallback); } /** * If an error or unhandled promise occurs, we mark the active transaction as failed */ function errorCallback() { var activeTransaction = (0,utils/* getActiveTransaction */.x1)(); if (activeTransaction) { var status = 'internal_error'; (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && logger/* logger.log */.kg.log(`[Tracing] Transaction: ${status} -> Global error occured`); activeTransaction.setStatus(status); } } //# sourceMappingURL=errors.js.map // EXTERNAL MODULE: ./node_modules/@sentry/tracing/esm/idletransaction.js var idletransaction = __webpack_require__(16458); // EXTERNAL MODULE: ./node_modules/@sentry/tracing/esm/transaction.js var esm_transaction = __webpack_require__(33391); ;// CONCATENATED MODULE: ./node_modules/@sentry/tracing/esm/hubextensions.js /* module decorator */ module = __webpack_require__.hmd(module); /** Returns all trace headers that are currently on the top scope. */ function traceHeaders() { var scope = this.getScope(); if (scope) { var span = scope.getSpan(); if (span) { return { 'sentry-trace': span.toTraceparent(), }; } } return {}; } /** * Makes a sampling decision for the given transaction and stores it on the transaction. * * Called every time a transaction is created. Only transactions which emerge with a `sampled` value of `true` will be * sent to Sentry. * * @param transaction: The transaction needing a sampling decision * @param options: The current client's options, so we can access `tracesSampleRate` and/or `tracesSampler` * @param samplingContext: Default and user-provided data which may be used to help make the decision * * @returns The given transaction with its `sampled` value set */ function sample( transaction, options, samplingContext, ) { // nothing to do if tracing is not enabled if (!(0,utils/* hasTracingEnabled */.zu)(options)) { transaction.sampled = false; return transaction; } // if the user has forced a sampling decision by passing a `sampled` value in their transaction context, go with that if (transaction.sampled !== undefined) { transaction.setMetadata({ transactionSampling: { method: 'explicitly_set' }, }); return transaction; } // we would have bailed already if neither `tracesSampler` nor `tracesSampleRate` were defined, so one of these should // work; prefer the hook if so let sampleRate; if (typeof options.tracesSampler === 'function') { sampleRate = options.tracesSampler(samplingContext); transaction.setMetadata({ transactionSampling: { method: 'client_sampler', // cast to number in case it's a boolean rate: Number(sampleRate), }, }); } else if (samplingContext.parentSampled !== undefined) { sampleRate = samplingContext.parentSampled; transaction.setMetadata({ transactionSampling: { method: 'inheritance' }, }); } else { sampleRate = options.tracesSampleRate; transaction.setMetadata({ transactionSampling: { method: 'client_rate', // cast to number in case it's a boolean rate: Number(sampleRate), }, }); } // Since this is coming from the user (or from a function provided by the user), who knows what we might get. (The // only valid values are booleans or numbers between 0 and 1.) if (!isValidSampleRate(sampleRate)) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && logger/* logger.warn */.kg.warn('[Tracing] Discarding transaction because of invalid sample rate.'); transaction.sampled = false; return transaction; } // if the function returned 0 (or false), or if `tracesSampleRate` is 0, it's a sign the transaction should be dropped if (!sampleRate) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && logger/* logger.log */.kg.log( `[Tracing] Discarding transaction because ${ typeof options.tracesSampler === 'function' ? 'tracesSampler returned 0 or false' : 'a negative sampling decision was inherited or tracesSampleRate is set to 0' }`, ); transaction.sampled = false; return transaction; } // Now we roll the dice. Math.random is inclusive of 0, but not of 1, so strict < is safe here. In case sampleRate is // a boolean, the < comparison will cause it to be automatically cast to 1 if it's true and 0 if it's false. transaction.sampled = Math.random() < (sampleRate ); // if we're not going to keep it, we're done if (!transaction.sampled) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && logger/* logger.log */.kg.log( `[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number( sampleRate, )})`, ); return transaction; } (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && logger/* logger.log */.kg.log(`[Tracing] starting ${transaction.op} transaction - ${transaction.name}`); return transaction; } /** * Checks the given sample rate to make sure it is valid type and value (a boolean, or a number between 0 and 1). */ function isValidSampleRate(rate) { // we need to check NaN explicitly because it's of type 'number' and therefore wouldn't get caught by this typecheck if ((0,is/* isNaN */.i2)(rate) || !(typeof rate === 'number' || typeof rate === 'boolean')) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && logger/* logger.warn */.kg.warn( `[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify( rate, )} of type ${JSON.stringify(typeof rate)}.`, ); return false; } // in case sampleRate is a boolean, it will get automatically cast to 1 if it's true and 0 if it's false if (rate < 0 || rate > 1) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && logger/* logger.warn */.kg.warn(`[Tracing] Given sample rate is invalid. Sample rate must be between 0 and 1. Got ${rate}.`); return false; } return true; } /** * Creates a new transaction and adds a sampling decision if it doesn't yet have one. * * The Hub.startTransaction method delegates to this method to do its work, passing the Hub instance in as `this`, as if * it had been called on the hub directly. Exists as a separate function so that it can be injected into the class as an * "extension method." * * @param this: The Hub starting the transaction * @param transactionContext: Data used to configure the transaction * @param CustomSamplingContext: Optional data to be provided to the `tracesSampler` function (if any) * * @returns The new transaction * * @see {@link Hub.startTransaction} */ function _startTransaction( transactionContext, customSamplingContext, ) { var client = this.getClient(); var options = (client && client.getOptions()) || {}; let transaction = new esm_transaction/* Transaction */.Y(transactionContext, this); transaction = sample(transaction, options, { parentSampled: transactionContext.parentSampled, transactionContext, ...customSamplingContext, }); if (transaction.sampled) { transaction.initSpanRecorder(options._experiments && (options._experiments.maxSpans )); } return transaction; } /** * Create new idle transaction. */ function startIdleTransaction( hub, transactionContext, idleTimeout, finalTimeout, onScope, customSamplingContext, ) { var client = hub.getClient(); var options = (client && client.getOptions()) || {}; let transaction = new idletransaction/* IdleTransaction */.io(transactionContext, hub, idleTimeout, finalTimeout, onScope); transaction = sample(transaction, options, { parentSampled: transactionContext.parentSampled, transactionContext, ...customSamplingContext, }); if (transaction.sampled) { transaction.initSpanRecorder(options._experiments && (options._experiments.maxSpans )); } return transaction; } /** * @private */ function _addTracingExtensions() { var carrier = (0,hub/* getMainCarrier */.cu)(); if (!carrier.__SENTRY__) { return; } carrier.__SENTRY__.extensions = carrier.__SENTRY__.extensions || {}; if (!carrier.__SENTRY__.extensions.startTransaction) { carrier.__SENTRY__.extensions.startTransaction = _startTransaction; } if (!carrier.__SENTRY__.extensions.traceHeaders) { carrier.__SENTRY__.extensions.traceHeaders = traceHeaders; } } /** * @private */ function _autoloadDatabaseIntegrations() { var carrier = (0,hub/* getMainCarrier */.cu)(); if (!carrier.__SENTRY__) { return; } var packageToIntegrationMapping = { mongodb() { var integration = (0,node/* dynamicRequire */.l$)(module, './integrations/node/mongo') ; return new integration.Mongo(); }, mongoose() { var integration = (0,node/* dynamicRequire */.l$)(module, './integrations/node/mongo') ; return new integration.Mongo({ mongoose: true }); }, mysql() { var integration = (0,node/* dynamicRequire */.l$)(module, './integrations/node/mysql') ; return new integration.Mysql(); }, pg() { var integration = (0,node/* dynamicRequire */.l$)(module, './integrations/node/postgres') ; return new integration.Postgres(); }, }; var mappedPackages = Object.keys(packageToIntegrationMapping) .filter(moduleName => !!(0,node/* loadModule */.$y)(moduleName)) .map(pkg => { try { return packageToIntegrationMapping[pkg](); } catch (e) { return undefined; } }) .filter(p => p) ; if (mappedPackages.length > 0) { carrier.__SENTRY__.integrations = [...(carrier.__SENTRY__.integrations || []), ...mappedPackages]; } } /** * This patches the global object and injects the Tracing extensions methods */ function addExtensionMethods() { _addTracingExtensions(); // Detect and automatically load specified integrations. if ((0,node/* isNodeEnv */.KV)()) { _autoloadDatabaseIntegrations(); } // If an error happens globally, we should make sure transaction status is set to error. registerErrorInstrumentation(); } //# sourceMappingURL=hubextensions.js.map /***/ }), /***/ 16458: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "io": function() { return /* binding */ IdleTransaction; }, /* harmony export */ "mg": function() { return /* binding */ DEFAULT_FINAL_TIMEOUT; }, /* harmony export */ "nT": function() { return /* binding */ DEFAULT_IDLE_TIMEOUT; } /* harmony export */ }); /* unused harmony exports HEARTBEAT_INTERVAL, IdleTransactionSpanRecorder */ /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(21170); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(12343); /* harmony import */ var _span_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(55334); /* harmony import */ var _transaction_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(33391); var DEFAULT_IDLE_TIMEOUT = 1000; var DEFAULT_FINAL_TIMEOUT = 30000; var HEARTBEAT_INTERVAL = 5000; /** * @inheritDoc */ class IdleTransactionSpanRecorder extends _span_js__WEBPACK_IMPORTED_MODULE_0__/* .SpanRecorder */ .gB { constructor( _pushActivity, _popActivity, transactionSpanId, maxlen, ) { super(maxlen);this._pushActivity = _pushActivity;this._popActivity = _popActivity;this.transactionSpanId = transactionSpanId;; } /** * @inheritDoc */ add(span) { // We should make sure we do not push and pop activities for // the transaction that this span recorder belongs to. if (span.spanId !== this.transactionSpanId) { // We patch span.finish() to pop an activity after setting an endTimestamp. span.finish = (endTimestamp) => { span.endTimestamp = typeof endTimestamp === 'number' ? endTimestamp : (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__/* .timestampWithMs */ ._I)(); this._popActivity(span.spanId); }; // We should only push new activities if the span does not have an end timestamp. if (span.endTimestamp === undefined) { this._pushActivity(span.spanId); } } super.add(span); } } /** * An IdleTransaction is a transaction that automatically finishes. It does this by tracking child spans as activities. * You can have multiple IdleTransactions active, but if the `onScope` option is specified, the idle transaction will * put itself on the scope on creation. */ class IdleTransaction extends _transaction_js__WEBPACK_IMPORTED_MODULE_2__/* .Transaction */ .Y { // Activities store a list of active spans __init() {this.activities = {};} // Track state of activities in previous heartbeat // Amount of times heartbeat has counted. Will cause transaction to finish after 3 beats. __init2() {this._heartbeatCounter = 0;} // We should not use heartbeat if we finished a transaction __init3() {this._finished = false;} __init4() {this._beforeFinishCallbacks = [];} /** * Timer that tracks Transaction idleTimeout */ constructor( transactionContext, _idleHub, /** * The time to wait in ms until the idle transaction will be finished. This timer is started each time * there are no active spans on this transaction. */ _idleTimeout = DEFAULT_IDLE_TIMEOUT, /** * The final value in ms that a transaction cannot exceed */ _finalTimeout = DEFAULT_FINAL_TIMEOUT, // Whether or not the transaction should put itself on the scope when it starts and pop itself off when it ends _onScope = false, ) { super(transactionContext, _idleHub);this._idleHub = _idleHub;this._idleTimeout = _idleTimeout;this._finalTimeout = _finalTimeout;this._onScope = _onScope;IdleTransaction.prototype.__init.call(this);IdleTransaction.prototype.__init2.call(this);IdleTransaction.prototype.__init3.call(this);IdleTransaction.prototype.__init4.call(this);; if (_onScope) { // There should only be one active transaction on the scope clearActiveTransaction(_idleHub); // We set the transaction here on the scope so error events pick up the trace // context and attach it to the error. (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_3__/* .logger.log */ .kg.log(`Setting idle transaction on scope. Span ID: ${this.spanId}`); _idleHub.configureScope(scope => scope.setSpan(this)); } this._startIdleTimeout(); setTimeout(() => { if (!this._finished) { this.setStatus('deadline_exceeded'); this.finish(); } }, this._finalTimeout); } /** {@inheritDoc} */ finish(endTimestamp = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__/* .timestampWithMs */ ._I)()) { this._finished = true; this.activities = {}; if (this.spanRecorder) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_3__/* .logger.log */ .kg.log('[Tracing] finishing IdleTransaction', new Date(endTimestamp * 1000).toISOString(), this.op); for (var callback of this._beforeFinishCallbacks) { callback(this, endTimestamp); } this.spanRecorder.spans = this.spanRecorder.spans.filter((span) => { // If we are dealing with the transaction itself, we just return it if (span.spanId === this.spanId) { return true; } // We cancel all pending spans with status "cancelled" to indicate the idle transaction was finished early if (!span.endTimestamp) { span.endTimestamp = endTimestamp; span.setStatus('cancelled'); (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_3__/* .logger.log */ .kg.log('[Tracing] cancelling span since transaction ended early', JSON.stringify(span, undefined, 2)); } var keepSpan = span.startTimestamp < endTimestamp; if (!keepSpan) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_3__/* .logger.log */ .kg.log( '[Tracing] discarding Span since it happened after Transaction was finished', JSON.stringify(span, undefined, 2), ); } return keepSpan; }); (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_3__/* .logger.log */ .kg.log('[Tracing] flushing IdleTransaction'); } else { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_3__/* .logger.log */ .kg.log('[Tracing] No active IdleTransaction'); } // if `this._onScope` is `true`, the transaction put itself on the scope when it started if (this._onScope) { clearActiveTransaction(this._idleHub); } return super.finish(endTimestamp); } /** * Register a callback function that gets excecuted before the transaction finishes. * Useful for cleanup or if you want to add any additional spans based on current context. * * This is exposed because users have no other way of running something before an idle transaction * finishes. */ registerBeforeFinishCallback(callback) { this._beforeFinishCallbacks.push(callback); } /** * @inheritDoc */ initSpanRecorder(maxlen) { if (!this.spanRecorder) { var pushActivity = (id) => { if (this._finished) { return; } this._pushActivity(id); }; var popActivity = (id) => { if (this._finished) { return; } this._popActivity(id); }; this.spanRecorder = new IdleTransactionSpanRecorder(pushActivity, popActivity, this.spanId, maxlen); // Start heartbeat so that transactions do not run forever. (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_3__/* .logger.log */ .kg.log('Starting heartbeat'); this._pingHeartbeat(); } this.spanRecorder.add(this); } /** * Cancels the existing idletimeout, if there is one */ _cancelIdleTimeout() { if (this._idleTimeoutID) { clearTimeout(this._idleTimeoutID); this._idleTimeoutID = undefined; } } /** * Creates an idletimeout */ _startIdleTimeout(endTimestamp) { this._cancelIdleTimeout(); this._idleTimeoutID = setTimeout(() => { if (!this._finished && Object.keys(this.activities).length === 0) { this.finish(endTimestamp); } }, this._idleTimeout); } /** * Start tracking a specific activity. * @param spanId The span id that represents the activity */ _pushActivity(spanId) { this._cancelIdleTimeout(); (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_3__/* .logger.log */ .kg.log(`[Tracing] pushActivity: ${spanId}`); this.activities[spanId] = true; (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_3__/* .logger.log */ .kg.log('[Tracing] new activities count', Object.keys(this.activities).length); } /** * Remove an activity from usage * @param spanId The span id that represents the activity */ _popActivity(spanId) { if (this.activities[spanId]) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_3__/* .logger.log */ .kg.log(`[Tracing] popActivity ${spanId}`); delete this.activities[spanId]; (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_3__/* .logger.log */ .kg.log('[Tracing] new activities count', Object.keys(this.activities).length); } if (Object.keys(this.activities).length === 0) { // We need to add the timeout here to have the real endtimestamp of the transaction // Remember timestampWithMs is in seconds, timeout is in ms var endTimestamp = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__/* .timestampWithMs */ ._I)() + this._idleTimeout / 1000; this._startIdleTimeout(endTimestamp); } } /** * Checks when entries of this.activities are not changing for 3 beats. * If this occurs we finish the transaction. */ _beat() { // We should not be running heartbeat if the idle transaction is finished. if (this._finished) { return; } var heartbeatString = Object.keys(this.activities).join(''); if (heartbeatString === this._prevHeartbeatString) { this._heartbeatCounter += 1; } else { this._heartbeatCounter = 1; } this._prevHeartbeatString = heartbeatString; if (this._heartbeatCounter >= 3) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_3__/* .logger.log */ .kg.log('[Tracing] Transaction finished because of no change for 3 heart beats'); this.setStatus('deadline_exceeded'); this.finish(); } else { this._pingHeartbeat(); } } /** * Pings the heartbeat */ _pingHeartbeat() { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_3__/* .logger.log */ .kg.log(`pinging Heartbeat -> current counter: ${this._heartbeatCounter}`); setTimeout(() => { this._beat(); }, HEARTBEAT_INTERVAL); } } /** * Reset transaction on scope to `undefined` */ function clearActiveTransaction(hub) { var scope = hub.getScope(); if (scope) { var transaction = scope.getTransaction(); if (transaction) { scope.setSpan(undefined); } } } //# sourceMappingURL=idletransaction.js.map /***/ }), /***/ 55334: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Dr": function() { return /* binding */ Span; }, /* harmony export */ "gB": function() { return /* binding */ SpanRecorder; } /* harmony export */ }); /* unused harmony export spanStatusfromHttpCode */ /* harmony import */ var _sentry_utils_esm_buildPolyfills__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(45375); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(62844); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(21170); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(12343); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(20535); /** * Keeps track of finished spans for a given transaction * @internal * @hideconstructor * @hidden */ class SpanRecorder { __init() {this.spans = [];} constructor(maxlen = 1000) {;SpanRecorder.prototype.__init.call(this); this._maxlen = maxlen; } /** * This is just so that we don't run out of memory while recording a lot * of spans. At some point we just stop and flush out the start of the * trace tree (i.e.the first n spans with the smallest * start_timestamp). */ add(span) { if (this.spans.length > this._maxlen) { span.spanRecorder = undefined; } else { this.spans.push(span); } } } /** * Span contains all data about a span */ class Span { /** * @inheritDoc */ __init2() {this.traceId = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__/* .uuid4 */ .DM)();} /** * @inheritDoc */ __init3() {this.spanId = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__/* .uuid4 */ .DM)().substring(16);} /** * @inheritDoc */ /** * Internal keeper of the status */ /** * @inheritDoc */ /** * Timestamp in seconds when the span was created. */ __init4() {this.startTimestamp = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__/* .timestampWithMs */ ._I)();} /** * Timestamp in seconds when the span ended. */ /** * @inheritDoc */ /** * @inheritDoc */ /** * @inheritDoc */ __init5() {this.tags = {};} /** * @inheritDoc */ __init6() {this.data = {};} /** * List of spans that were finalized */ /** * @inheritDoc */ /** * You should never call the constructor manually, always use `Sentry.startTransaction()` * or call `startChild()` on an existing span. * @internal * @hideconstructor * @hidden */ constructor(spanContext) {;Span.prototype.__init2.call(this);Span.prototype.__init3.call(this);Span.prototype.__init4.call(this);Span.prototype.__init5.call(this);Span.prototype.__init6.call(this); if (!spanContext) { return this; } if (spanContext.traceId) { this.traceId = spanContext.traceId; } if (spanContext.spanId) { this.spanId = spanContext.spanId; } if (spanContext.parentSpanId) { this.parentSpanId = spanContext.parentSpanId; } // We want to include booleans as well here if ('sampled' in spanContext) { this.sampled = spanContext.sampled; } if (spanContext.op) { this.op = spanContext.op; } if (spanContext.description) { this.description = spanContext.description; } if (spanContext.data) { this.data = spanContext.data; } if (spanContext.tags) { this.tags = spanContext.tags; } if (spanContext.status) { this.status = spanContext.status; } if (spanContext.startTimestamp) { this.startTimestamp = spanContext.startTimestamp; } if (spanContext.endTimestamp) { this.endTimestamp = spanContext.endTimestamp; } } /** * @inheritDoc */ startChild( spanContext, ) { var childSpan = new Span({ ...spanContext, parentSpanId: this.spanId, sampled: this.sampled, traceId: this.traceId, }); childSpan.spanRecorder = this.spanRecorder; if (childSpan.spanRecorder) { childSpan.spanRecorder.add(childSpan); } childSpan.transaction = this.transaction; if ((typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && childSpan.transaction) { var opStr = (spanContext && spanContext.op) || '< unknown op >'; var nameStr = childSpan.transaction.name || '< unknown name >'; var idStr = childSpan.transaction.spanId; var logMessage = `[Tracing] Starting '${opStr}' span on transaction '${nameStr}' (${idStr}).`; childSpan.transaction.metadata.spanMetadata[childSpan.spanId] = { logMessage }; _sentry_utils__WEBPACK_IMPORTED_MODULE_2__/* .logger.log */ .kg.log(logMessage); } return childSpan; } /** * @inheritDoc */ setTag(key, value) { this.tags = { ...this.tags, [key]: value }; return this; } /** * @inheritDoc */ setData(key, value) { this.data = { ...this.data, [key]: value }; return this; } /** * @inheritDoc */ setStatus(value) { this.status = value; return this; } /** * @inheritDoc */ setHttpStatus(httpStatus) { this.setTag('http.status_code', String(httpStatus)); var spanStatus = spanStatusfromHttpCode(httpStatus); if (spanStatus !== 'unknown_error') { this.setStatus(spanStatus); } return this; } /** * @inheritDoc */ isSuccess() { return this.status === 'ok'; } /** * @inheritDoc */ finish(endTimestamp) { if ( (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && // Don't call this for transactions this.transaction && this.transaction.spanId !== this.spanId ) { const { logMessage } = this.transaction.metadata.spanMetadata[this.spanId]; if (logMessage) { _sentry_utils__WEBPACK_IMPORTED_MODULE_2__/* .logger.log */ .kg.log((logMessage ).replace('Starting', 'Finishing')); } } this.endTimestamp = typeof endTimestamp === 'number' ? endTimestamp : (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_1__/* .timestampWithMs */ ._I)(); } /** * @inheritDoc */ toTraceparent() { let sampledString = ''; if (this.sampled !== undefined) { sampledString = this.sampled ? '-1' : '-0'; } return `${this.traceId}-${this.spanId}${sampledString}`; } /** * @inheritDoc */ toContext() { return (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_3__/* .dropUndefinedKeys */ .Jr)({ data: this.data, description: this.description, endTimestamp: this.endTimestamp, op: this.op, parentSpanId: this.parentSpanId, sampled: this.sampled, spanId: this.spanId, startTimestamp: this.startTimestamp, status: this.status, tags: this.tags, traceId: this.traceId, }); } /** * @inheritDoc */ updateWithContext(spanContext) { this.data = (0,_sentry_utils_esm_buildPolyfills__WEBPACK_IMPORTED_MODULE_4__/* ._nullishCoalesce */ .h)(spanContext.data, () => ( {})); this.description = spanContext.description; this.endTimestamp = spanContext.endTimestamp; this.op = spanContext.op; this.parentSpanId = spanContext.parentSpanId; this.sampled = spanContext.sampled; this.spanId = (0,_sentry_utils_esm_buildPolyfills__WEBPACK_IMPORTED_MODULE_4__/* ._nullishCoalesce */ .h)(spanContext.spanId, () => ( this.spanId)); this.startTimestamp = (0,_sentry_utils_esm_buildPolyfills__WEBPACK_IMPORTED_MODULE_4__/* ._nullishCoalesce */ .h)(spanContext.startTimestamp, () => ( this.startTimestamp)); this.status = spanContext.status; this.tags = (0,_sentry_utils_esm_buildPolyfills__WEBPACK_IMPORTED_MODULE_4__/* ._nullishCoalesce */ .h)(spanContext.tags, () => ( {})); this.traceId = (0,_sentry_utils_esm_buildPolyfills__WEBPACK_IMPORTED_MODULE_4__/* ._nullishCoalesce */ .h)(spanContext.traceId, () => ( this.traceId)); return this; } /** * @inheritDoc */ getTraceContext() { return (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_3__/* .dropUndefinedKeys */ .Jr)({ data: Object.keys(this.data).length > 0 ? this.data : undefined, description: this.description, op: this.op, parent_span_id: this.parentSpanId, span_id: this.spanId, status: this.status, tags: Object.keys(this.tags).length > 0 ? this.tags : undefined, trace_id: this.traceId, }); } /** * @inheritDoc */ toJSON() { return (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_3__/* .dropUndefinedKeys */ .Jr)({ data: Object.keys(this.data).length > 0 ? this.data : undefined, description: this.description, op: this.op, parent_span_id: this.parentSpanId, span_id: this.spanId, start_timestamp: this.startTimestamp, status: this.status, tags: Object.keys(this.tags).length > 0 ? this.tags : undefined, timestamp: this.endTimestamp, trace_id: this.traceId, }); } } /** * Converts a HTTP status code into a {@link SpanStatusType}. * * @param httpStatus The HTTP response status code. * @returns The span status or unknown_error. */ function spanStatusfromHttpCode(httpStatus) { if (httpStatus < 400 && httpStatus >= 100) { return 'ok'; } if (httpStatus >= 400 && httpStatus < 500) { switch (httpStatus) { case 401: return 'unauthenticated'; case 403: return 'permission_denied'; case 404: return 'not_found'; case 409: return 'already_exists'; case 413: return 'failed_precondition'; case 429: return 'resource_exhausted'; default: return 'invalid_argument'; } } if (httpStatus >= 500 && httpStatus < 600) { switch (httpStatus) { case 501: return 'unimplemented'; case 503: return 'unavailable'; case 504: return 'deadline_exceeded'; default: return 'internal_error'; } } return 'unknown_error'; } //# sourceMappingURL=span.js.map /***/ }), /***/ 33391: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Y": function() { return /* binding */ Transaction; } /* harmony export */ }); /* harmony import */ var _sentry_utils_esm_buildPolyfills__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(45375); /* harmony import */ var _sentry_hub__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(38641); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(12343); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(20535); /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(99181); /* harmony import */ var _span_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(55334); /** JSDoc */ class Transaction extends _span_js__WEBPACK_IMPORTED_MODULE_0__/* .Span */ .Dr { /** * The reference to the current hub. */ __init() {this._measurements = {};} /** * This constructor should never be called manually. Those instrumenting tracing should use * `Sentry.startTransaction()`, and internal methods should use `hub.startTransaction()`. * @internal * @hideconstructor * @hidden */ constructor(transactionContext, hub) { super(transactionContext);Transaction.prototype.__init.call(this);; this._hub = hub || (0,_sentry_hub__WEBPACK_IMPORTED_MODULE_1__/* .getCurrentHub */ .Gd)(); this._name = transactionContext.name || ''; this.metadata = { ...transactionContext.metadata, spanMetadata: {}, }; this._trimEnd = transactionContext.trimEnd; // this is because transactions are also spans, and spans have a transaction pointer this.transaction = this; } /** Getter for `name` property */ get name() { return this._name; } /** Setter for `name` property, which also sets `source` */ set name(newName) { this._name = newName; this.metadata.source = 'custom'; } /** * JSDoc */ setName(name, source = 'custom') { this.name = name; this.metadata.source = source; } /** * Attaches SpanRecorder to the span itself * @param maxlen maximum number of spans that can be recorded */ initSpanRecorder(maxlen = 1000) { if (!this.spanRecorder) { this.spanRecorder = new _span_js__WEBPACK_IMPORTED_MODULE_0__/* .SpanRecorder */ .gB(maxlen); } this.spanRecorder.add(this); } /** * @inheritDoc */ setMeasurement(name, value, unit = '') { this._measurements[name] = { value, unit }; } /** * @inheritDoc */ setMetadata(newMetadata) { this.metadata = { ...this.metadata, ...newMetadata }; } /** * @inheritDoc */ finish(endTimestamp) { // This transaction is already finished, so we should not flush it again. if (this.endTimestamp !== undefined) { return undefined; } if (!this.name) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_2__/* .logger.warn */ .kg.warn('Transaction has no name, falling back to ``.'); this.name = ''; } // just sets the end timestamp super.finish(endTimestamp); if (this.sampled !== true) { // At this point if `sampled !== true` we want to discard the transaction. (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_2__/* .logger.log */ .kg.log('[Tracing] Discarding transaction because its trace was not chosen to be sampled.'); var client = this._hub.getClient(); if (client) { client.recordDroppedEvent('sample_rate', 'transaction'); } return undefined; } var finishedSpans = this.spanRecorder ? this.spanRecorder.spans.filter(s => s !== this && s.endTimestamp) : []; if (this._trimEnd && finishedSpans.length > 0) { this.endTimestamp = finishedSpans.reduce((prev, current) => { if (prev.endTimestamp && current.endTimestamp) { return prev.endTimestamp > current.endTimestamp ? prev : current; } return prev; }).endTimestamp; } var metadata = this.metadata; var transaction = { contexts: { trace: this.getTraceContext(), }, spans: finishedSpans, start_timestamp: this.startTimestamp, tags: this.tags, timestamp: this.endTimestamp, transaction: this.name, type: 'transaction', sdkProcessingMetadata: { ...metadata, baggage: this.getBaggage(), }, ...(metadata.source && { transaction_info: { source: metadata.source, }, }), }; var hasMeasurements = Object.keys(this._measurements).length > 0; if (hasMeasurements) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_2__/* .logger.log */ .kg.log( '[Measurements] Adding measurements to transaction', JSON.stringify(this._measurements, undefined, 2), ); transaction.measurements = this._measurements; } (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_2__/* .logger.log */ .kg.log(`[Tracing] Finishing ${this.op} transaction: ${this.name}.`); return this._hub.captureEvent(transaction); } /** * @inheritDoc */ toContext() { var spanContext = super.toContext(); return (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_3__/* .dropUndefinedKeys */ .Jr)({ ...spanContext, name: this.name, trimEnd: this._trimEnd, }); } /** * @inheritDoc */ updateWithContext(transactionContext) { super.updateWithContext(transactionContext); this.name = (0,_sentry_utils_esm_buildPolyfills__WEBPACK_IMPORTED_MODULE_4__/* ._nullishCoalesce */ .h)(transactionContext.name, () => ( '')); this._trimEnd = transactionContext.trimEnd; return this; } /** * @inheritdoc * * @experimental */ getBaggage() { var existingBaggage = this.metadata.baggage; // Only add Sentry baggage items to baggage, if baggage does not exist yet or it is still // empty and mutable var finalBaggage = !existingBaggage || (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_5__/* .isBaggageMutable */ .Gp)(existingBaggage) ? this._populateBaggageWithSentryValues(existingBaggage) : existingBaggage; // Update the baggage stored on the transaction. this.metadata.baggage = finalBaggage; return finalBaggage; } /** * Collects and adds data to the passed baggage object. * * Note: This function does not explicitly check if the passed baggage object is allowed * to be modified. Implicitly, `setBaggageValue` will not make modification to the object * if it was already set immutable. * * After adding the data, the baggage object is set immutable to prevent further modifications. * * @param baggage * * @returns modified and immutable baggage object */ _populateBaggageWithSentryValues(baggage = (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_5__/* .createBaggage */ .Hn)({})) { var hub = this._hub || (0,_sentry_hub__WEBPACK_IMPORTED_MODULE_1__/* .getCurrentHub */ .Gd)(); var client = hub && hub.getClient(); if (!client) return baggage; const { environment, release } = client.getOptions() || {}; const { publicKey: public_key } = client.getDsn() || {}; var sample_rate = this.metadata && this.metadata.transactionSampling && this.metadata.transactionSampling.rate && this.metadata.transactionSampling.rate.toString(); var scope = hub.getScope(); const { segment: user_segment } = (scope && scope.getUser()) || {}; var source = this.metadata.source; var transaction = source && source !== 'url' ? this.name : undefined; return (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_5__/* .createBaggage */ .Hn)( (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_3__/* .dropUndefinedKeys */ .Jr)({ environment, release, transaction, user_segment, public_key, trace_id: this.traceId, sample_rate, ...(0,_sentry_utils__WEBPACK_IMPORTED_MODULE_5__/* .getSentryBaggageItems */ .Hk)(baggage), // keep user-added values } ), '', false, // set baggage immutable ); } } //# sourceMappingURL=transaction.js.map /***/ }), /***/ 63233: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "XL": function() { return /* binding */ msToSec; }, /* harmony export */ "x1": function() { return /* binding */ getActiveTransaction; }, /* harmony export */ "zu": function() { return /* binding */ hasTracingEnabled; } /* harmony export */ }); /* unused harmony export secToMs */ /* harmony import */ var _sentry_hub__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(38641); /** * Determines if tracing is currently enabled. * * Tracing is enabled when at least one of `tracesSampleRate` and `tracesSampler` is defined in the SDK config. */ function hasTracingEnabled( maybeOptions, ) { var client = (0,_sentry_hub__WEBPACK_IMPORTED_MODULE_0__/* .getCurrentHub */ .Gd)().getClient(); var options = maybeOptions || (client && client.getOptions()); return !!options && ('tracesSampleRate' in options || 'tracesSampler' in options); } /** Grabs active transaction off scope, if any */ function getActiveTransaction(maybeHub) { var hub = maybeHub || (0,_sentry_hub__WEBPACK_IMPORTED_MODULE_0__/* .getCurrentHub */ .Gd)(); var scope = hub.getScope(); return scope && (scope.getTransaction() ); } /** * Converts from milliseconds to seconds * @param time time in ms */ function msToSec(time) { return time / 1000; } /** * Converts from seconds to milliseconds * @param time time in seconds */ function secToMs(time) { return time * 1000; } //# sourceMappingURL=utils.js.map /***/ }), /***/ 99181: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Gp": function() { return /* binding */ isBaggageMutable; }, /* harmony export */ "Hk": function() { return /* binding */ getSentryBaggageItems; }, /* harmony export */ "Hn": function() { return /* binding */ createBaggage; }, /* harmony export */ "J8": function() { return /* binding */ mergeAndSerializeBaggage; }, /* harmony export */ "XM": function() { return /* binding */ parseBaggageHeader; }, /* harmony export */ "bU": function() { return /* binding */ BAGGAGE_HEADER_NAME; }, /* harmony export */ "rg": function() { return /* binding */ parseBaggageSetMutability; } /* harmony export */ }); /* unused harmony exports MAX_BAGGAGE_STRING_LENGTH, SENTRY_BAGGAGE_KEY_PREFIX, SENTRY_BAGGAGE_KEY_PREFIX_REGEX, getBaggageValue, getThirdPartyBaggage, isSentryBaggageEmpty, serializeBaggage, setBaggageImmutable, setBaggageValue */ /* harmony import */ var _is_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67597); /* harmony import */ var _logger_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(12343); var BAGGAGE_HEADER_NAME = 'baggage'; var SENTRY_BAGGAGE_KEY_PREFIX = 'sentry-'; var SENTRY_BAGGAGE_KEY_PREFIX_REGEX = /^sentry-/; /** * Max length of a serialized baggage string * * https://www.w3.org/TR/baggage/#limits */ var MAX_BAGGAGE_STRING_LENGTH = 8192; /** Create an instance of Baggage */ function createBaggage(initItems, baggageString = '', mutable = true) { return [{ ...initItems }, baggageString, mutable]; } /** Get a value from baggage */ function getBaggageValue(baggage, key) { return baggage[0][key]; } /** Add a value to baggage */ function setBaggageValue(baggage, key, value) { if (isBaggageMutable(baggage)) { baggage[0][key] = value; } } /** Check if the Sentry part of the passed baggage (i.e. the first element in the tuple) is empty */ function isSentryBaggageEmpty(baggage) { return Object.keys(baggage[0]).length === 0; } /** Returns Sentry specific baggage values */ function getSentryBaggageItems(baggage) { return baggage[0]; } /** * Returns 3rd party baggage string of @param baggage * @param baggage */ function getThirdPartyBaggage(baggage) { return baggage[1]; } /** * Checks if baggage is mutable * @param baggage * @returns true if baggage is mutable, else false */ function isBaggageMutable(baggage) { return baggage[2]; } /** * Sets the passed baggage immutable * @param baggage */ function setBaggageImmutable(baggage) { baggage[2] = false; } /** Serialize a baggage object */ function serializeBaggage(baggage) { return Object.keys(baggage[0]).reduce((prev, key) => { var val = baggage[0][key] ; var baggageEntry = `${SENTRY_BAGGAGE_KEY_PREFIX}${encodeURIComponent(key)}=${encodeURIComponent(val)}`; var newVal = prev === '' ? baggageEntry : `${prev},${baggageEntry}`; if (newVal.length > MAX_BAGGAGE_STRING_LENGTH) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _logger_js__WEBPACK_IMPORTED_MODULE_0__/* .logger.warn */ .kg.warn(`Not adding key: ${key} with val: ${val} to baggage due to exceeding baggage size limits.`); return prev; } else { return newVal; } }, baggage[1]); } /** * Parse a baggage header from a string or a string array and return a Baggage object * * If @param includeThirdPartyEntries is set to true, third party baggage entries are added to the Baggage object * (This is necessary for merging potentially pre-existing baggage headers in outgoing requests with * our `sentry-` values) */ function parseBaggageHeader( inputBaggageValue, includeThirdPartyEntries = false, ) { // Adding this check here because we got reports of this function failing due to the input value // not being a string. This debug log might help us determine what's going on here. if ((!Array.isArray(inputBaggageValue) && !(0,_is_js__WEBPACK_IMPORTED_MODULE_1__/* .isString */ .HD)(inputBaggageValue)) || typeof inputBaggageValue === 'number') { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _logger_js__WEBPACK_IMPORTED_MODULE_0__/* .logger.warn */ .kg.warn( '[parseBaggageHeader] Received input value of incompatible type: ', typeof inputBaggageValue, inputBaggageValue, ); // Gonna early-return an empty baggage object so that we don't fail later on return createBaggage({}, ''); } var baggageEntries = ((0,_is_js__WEBPACK_IMPORTED_MODULE_1__/* .isString */ .HD)(inputBaggageValue) ? inputBaggageValue : inputBaggageValue.join(',')) .split(',') .map(entry => entry.trim()) .filter(entry => entry !== '' && (includeThirdPartyEntries || SENTRY_BAGGAGE_KEY_PREFIX_REGEX.test(entry))); return baggageEntries.reduce( ([baggageObj, baggageString], curr) => { const [key, val] = curr.split('='); if (SENTRY_BAGGAGE_KEY_PREFIX_REGEX.test(key)) { var baggageKey = decodeURIComponent(key.split('-')[1]); return [ { ...baggageObj, [baggageKey]: decodeURIComponent(val), }, baggageString, true, ]; } else { return [baggageObj, baggageString === '' ? curr : `${baggageString},${curr}`, true]; } }, [{}, '', true], ); } /** * Merges the baggage header we saved from the incoming request (or meta tag) with * a possibly created or modified baggage header by a third party that's been added * to the outgoing request header. * * In case @param headerBaggageString exists, we can safely add the the 3rd party part of @param headerBaggage * with our @param incomingBaggage. This is possible because if we modified anything beforehand, * it would only affect parts of the sentry baggage (@see Baggage interface). * * @param incomingBaggage the baggage header of the incoming request that might contain sentry entries * @param thirdPartyBaggageHeader possibly existing baggage header string or string[] added from a third * party to the request headers * * @return a merged and serialized baggage string to be propagated with the outgoing request */ function mergeAndSerializeBaggage(incomingBaggage, thirdPartyBaggageHeader) { if (!incomingBaggage && !thirdPartyBaggageHeader) { return ''; } var headerBaggage = (thirdPartyBaggageHeader && parseBaggageHeader(thirdPartyBaggageHeader, true)) || undefined; var thirdPartyHeaderBaggage = headerBaggage && getThirdPartyBaggage(headerBaggage); var finalBaggage = createBaggage((incomingBaggage && incomingBaggage[0]) || {}, thirdPartyHeaderBaggage || ''); return serializeBaggage(finalBaggage); } /** * Helper function that takes a raw baggage string (if available) and the processed sentry-trace header * data (if available), parses the baggage string and creates a Baggage object * If there is no baggage string, it will create an empty Baggage object. * In a second step, this functions determines if the created Baggage object should be set immutable * to prevent mutation of the Sentry data. * * Extracted this logic to a function because it's duplicated in a lot of places. * * @param rawBaggageValue * @param sentryTraceHeader */ function parseBaggageSetMutability( rawBaggageValue, sentryTraceHeader, ) { var baggage = parseBaggageHeader(rawBaggageValue || ''); // Because we are always creating a Baggage object by calling `parseBaggageHeader` above // (either a filled one or an empty one, even if we didn't get a `baggage` header), // we only need to check if we have a sentry-trace header or not. As soon as we have it, // we set baggage immutable. In case we don't get a sentry-trace header, we can assume that // this SDK is the head of the trace and thus we still permit mutation at this time. // There is one exception though, which is that we get a baggage-header with `sentry-` // items but NO sentry-trace header. In this case we also set the baggage immutable for now // but if smoething like this would ever happen, we should revisit this and determine // what this would actually mean for the trace (i.e. is this SDK the head?, what happened // before that we don't have a sentry-trace header?, etc) (sentryTraceHeader || !isSentryBaggageEmpty(baggage)) && setBaggageImmutable(baggage); return baggage; } //# sourceMappingURL=baggage.js.map /***/ }), /***/ 58464: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "R": function() { return /* binding */ htmlTreeAsString; }, /* harmony export */ "l": function() { return /* binding */ getLocationHref; } /* harmony export */ }); /* harmony import */ var _global_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(82991); /* harmony import */ var _is_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(67597); /** * Given a child DOM element, returns a query-selector statement describing that * and its ancestors * e.g. [HTMLElement] => body > div > input#foo.btn[name=baz] * @returns generated DOM path */ function htmlTreeAsString(elem, keyAttrs) { // try/catch both: // - accessing event.target (see getsentry/raven-js#838, #768) // - `htmlTreeAsString` because it's complex, and just accessing the DOM incorrectly // - can throw an exception in some circumstances. try { let currentElem = elem ; var MAX_TRAVERSE_HEIGHT = 5; var MAX_OUTPUT_LEN = 80; var out = []; let height = 0; let len = 0; var separator = ' > '; var sepLength = separator.length; let nextStr; while (currentElem && height++ < MAX_TRAVERSE_HEIGHT) { nextStr = _htmlElementAsString(currentElem, keyAttrs); // bail out if // - nextStr is the 'html' element // - the length of the string that would be created exceeds MAX_OUTPUT_LEN // (ignore this limit if we are on the first iteration) if (nextStr === 'html' || (height > 1 && len + out.length * sepLength + nextStr.length >= MAX_OUTPUT_LEN)) { break; } out.push(nextStr); len += nextStr.length; currentElem = currentElem.parentNode; } return out.reverse().join(separator); } catch (_oO) { return ''; } } /** * Returns a simple, query-selector representation of a DOM element * e.g. [HTMLElement] => input#foo.btn[name=baz] * @returns generated DOM path */ function _htmlElementAsString(el, keyAttrs) { var elem = el ; var out = []; let className; let classes; let key; let attr; let i; if (!elem || !elem.tagName) { return ''; } out.push(elem.tagName.toLowerCase()); // Pairs of attribute keys defined in `serializeAttribute` and their values on element. var keyAttrPairs = keyAttrs && keyAttrs.length ? keyAttrs.filter(keyAttr => elem.getAttribute(keyAttr)).map(keyAttr => [keyAttr, elem.getAttribute(keyAttr)]) : null; if (keyAttrPairs && keyAttrPairs.length) { keyAttrPairs.forEach(keyAttrPair => { out.push(`[${keyAttrPair[0]}="${keyAttrPair[1]}"]`); }); } else { if (elem.id) { out.push(`#${elem.id}`); } className = elem.className; if (className && (0,_is_js__WEBPACK_IMPORTED_MODULE_0__/* .isString */ .HD)(className)) { classes = className.split(/\s+/); for (i = 0; i < classes.length; i++) { out.push(`.${classes[i]}`); } } } var allowedAttrs = ['type', 'name', 'title', 'alt']; for (i = 0; i < allowedAttrs.length; i++) { key = allowedAttrs[i]; attr = elem.getAttribute(key); if (attr) { out.push(`[${key}="${attr}"]`); } } return out.join(''); } /** * A safe form of location.href */ function getLocationHref() { var global = (0,_global_js__WEBPACK_IMPORTED_MODULE_1__/* .getGlobalObject */ .R)(); try { return global.document.location.href; } catch (oO) { return ''; } } //# sourceMappingURL=browser.js.map /***/ }), /***/ 45375: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "h": function() { return /* binding */ _nullishCoalesce; } /* harmony export */ }); /** * Polyfill for the nullish coalescing operator (`??`). * * Note that the RHS is wrapped in a function so that if it's a computed value, that evaluation won't happen unless the * LHS evaluates to a nullish value, to mimic the operator's short-circuiting behavior. * * Adapted from Sucrase (https://github.com/alangpierce/sucrase) * * @param lhs The value of the expression to the left of the `??` * @param rhsFn A function returning the value of the expression to the right of the `??` * @returns The LHS value, unless it's `null` or `undefined`, in which case, the RHS value */ function _nullishCoalesce(lhs, rhsFn) { // by checking for loose equality to `null`, we catch both `null` and `undefined` return lhs != null ? lhs : rhsFn(); } // Sucrase version: // function _nullishCoalesce(lhs, rhsFn) { // if (lhs != null) { // return lhs; // } else { // return rhsFn(); // } // } //# sourceMappingURL=_nullishCoalesce.js.map /***/ }), /***/ 64307: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "x": function() { return /* binding */ _optionalChain; } /* harmony export */ }); /** * Polyfill for the optional chain operator, `?.`, given previous conversion of the expression into an array of values, * descriptors, and functions. * * Adapted from Sucrase (https://github.com/alangpierce/sucrase) * See https://github.com/alangpierce/sucrase/blob/265887868966917f3b924ce38dfad01fbab1329f/src/transformers/OptionalChainingNullishTransformer.ts#L15 * * @param ops Array result of expression conversion * @returns The value of the expression */ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { var op = ops[i] ; var fn = ops[i + 1] ; i += 2; // by checking for loose equality to `null`, we catch both `null` and `undefined` if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { // really we're meaning to return `undefined` as an actual value here, but it saves bytes not to write it return; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => (value ).call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } // Sucrase version // function _optionalChain(ops) { // let lastAccessLHS = undefined; // let value = ops[0]; // let i = 1; // while (i < ops.length) { // var op = ops[i]; // var fn = ops[i + 1]; // i += 2; // if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { // return undefined; // } // if (op === 'access' || op === 'optionalAccess') { // lastAccessLHS = value; // value = fn(value); // } else if (op === 'call' || op === 'optionalCall') { // value = fn((...args) => value.call(lastAccessLHS, ...args)); // lastAccessLHS = undefined; // } // } // return value; // } //# sourceMappingURL=_optionalChain.js.map /***/ }), /***/ 82991: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "R": function() { return /* binding */ getGlobalObject; }, /* harmony export */ "Y": function() { return /* binding */ getGlobalSingleton; } /* harmony export */ }); /* harmony import */ var _node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(92448); /** Internal */ var fallbackGlobalObject = {}; /** * Safely get global scope object * * @returns Global scope object */ function getGlobalObject() { return ( (0,_node_js__WEBPACK_IMPORTED_MODULE_0__/* .isNodeEnv */ .KV)() ? __webpack_require__.g : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : fallbackGlobalObject ) ; } /** * Returns a global singleton contained in the global `__SENTRY__` object. * * If the singleton doesn't already exist in `__SENTRY__`, it will be created using the given factory * function and added to the `__SENTRY__` object. * * @param name name of the global singleton on __SENTRY__ * @param creator creator Factory function to create the singleton if it doesn't already exist on `__SENTRY__` * @param obj (Optional) The global object on which to look for `__SENTRY__`, if not `getGlobalObject`'s return value * @returns the singleton */ function getGlobalSingleton(name, creator, obj) { var global = (obj || getGlobalObject()) ; var __SENTRY__ = (global.__SENTRY__ = global.__SENTRY__ || {}); var singleton = __SENTRY__[name] || (__SENTRY__[name] = creator()); return singleton; } //# sourceMappingURL=global.js.map /***/ }), /***/ 9732: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "o": function() { return /* binding */ addInstrumentationHandler; } /* harmony export */ }); /* harmony import */ var _global_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(82991); /* harmony import */ var _is_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(67597); /* harmony import */ var _logger_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(12343); /* harmony import */ var _object_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(20535); /* harmony import */ var _stacktrace_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(30360); /* harmony import */ var _supports_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(8823); var global = (0,_global_js__WEBPACK_IMPORTED_MODULE_0__/* .getGlobalObject */ .R)(); /** * Instrument native APIs to call handlers that can be used to create breadcrumbs, APM spans etc. * - Console API * - Fetch API * - XHR API * - History API * - DOM API (click/typing) * - Error API * - UnhandledRejection API */ var handlers = {}; var instrumented = {}; /** Instruments given API */ function instrument(type) { if (instrumented[type]) { return; } instrumented[type] = true; switch (type) { case 'console': instrumentConsole(); break; case 'dom': instrumentDOM(); break; case 'xhr': instrumentXHR(); break; case 'fetch': instrumentFetch(); break; case 'history': instrumentHistory(); break; case 'error': instrumentError(); break; case 'unhandledrejection': instrumentUnhandledRejection(); break; default: (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _logger_js__WEBPACK_IMPORTED_MODULE_1__/* .logger.warn */ .kg.warn('unknown instrumentation type:', type); return; } } /** * Add handler that will be called when given type of instrumentation triggers. * Use at your own risk, this might break without changelog notice, only used internally. * @hidden */ function addInstrumentationHandler(type, callback) { handlers[type] = handlers[type] || []; (handlers[type] ).push(callback); instrument(type); } /** JSDoc */ function triggerHandlers(type, data) { if (!type || !handlers[type]) { return; } for (var handler of handlers[type] || []) { try { handler(data); } catch (e) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _logger_js__WEBPACK_IMPORTED_MODULE_1__/* .logger.error */ .kg.error( `Error while triggering instrumentation handler.\nType: ${type}\nName: ${(0,_stacktrace_js__WEBPACK_IMPORTED_MODULE_2__/* .getFunctionName */ .$P)(handler)}\nError:`, e, ); } } } /** JSDoc */ function instrumentConsole() { if (!('console' in global)) { return; } _logger_js__WEBPACK_IMPORTED_MODULE_1__/* .CONSOLE_LEVELS.forEach */ .RU.forEach(function (level) { if (!(level in global.console)) { return; } (0,_object_js__WEBPACK_IMPORTED_MODULE_3__/* .fill */ .hl)(global.console, level, function (originalConsoleMethod) { return function (...args) { triggerHandlers('console', { args, level }); // this fails for some browsers. :( if (originalConsoleMethod) { originalConsoleMethod.apply(global.console, args); } }; }); }); } /** JSDoc */ function instrumentFetch() { if (!(0,_supports_js__WEBPACK_IMPORTED_MODULE_4__/* .supportsNativeFetch */ .t$)()) { return; } (0,_object_js__WEBPACK_IMPORTED_MODULE_3__/* .fill */ .hl)(global, 'fetch', function (originalFetch) { return function (...args) { var handlerData = { args, fetchData: { method: getFetchMethod(args), url: getFetchUrl(args), }, startTimestamp: Date.now(), }; triggerHandlers('fetch', { ...handlerData, }); return originalFetch.apply(global, args).then( (response) => { triggerHandlers('fetch', { ...handlerData, endTimestamp: Date.now(), response, }); return response; }, (error) => { triggerHandlers('fetch', { ...handlerData, endTimestamp: Date.now(), error, }); // NOTE: If you are a Sentry user, and you are seeing this stack frame, // it means the sentry.javascript SDK caught an error invoking your application code. // This is expected behavior and NOT indicative of a bug with sentry.javascript. throw error; }, ); }; }); } /** Extract `method` from fetch call arguments */ function getFetchMethod(fetchArgs = []) { if ('Request' in global && (0,_is_js__WEBPACK_IMPORTED_MODULE_5__/* .isInstanceOf */ .V9)(fetchArgs[0], Request) && fetchArgs[0].method) { return String(fetchArgs[0].method).toUpperCase(); } if (fetchArgs[1] && fetchArgs[1].method) { return String(fetchArgs[1].method).toUpperCase(); } return 'GET'; } /** Extract `url` from fetch call arguments */ function getFetchUrl(fetchArgs = []) { if (typeof fetchArgs[0] === 'string') { return fetchArgs[0]; } if ('Request' in global && (0,_is_js__WEBPACK_IMPORTED_MODULE_5__/* .isInstanceOf */ .V9)(fetchArgs[0], Request)) { return fetchArgs[0].url; } return String(fetchArgs[0]); } /** JSDoc */ function instrumentXHR() { if (!('XMLHttpRequest' in global)) { return; } var xhrproto = XMLHttpRequest.prototype; (0,_object_js__WEBPACK_IMPORTED_MODULE_3__/* .fill */ .hl)(xhrproto, 'open', function (originalOpen) { return function ( ...args) { var xhr = this; var url = args[1]; var xhrInfo = (xhr.__sentry_xhr__ = { method: (0,_is_js__WEBPACK_IMPORTED_MODULE_5__/* .isString */ .HD)(args[0]) ? args[0].toUpperCase() : args[0], url: args[1], }); // if Sentry key appears in URL, don't capture it as a request if ((0,_is_js__WEBPACK_IMPORTED_MODULE_5__/* .isString */ .HD)(url) && xhrInfo.method === 'POST' && url.match(/sentry_key/)) { xhr.__sentry_own_request__ = true; } var onreadystatechangeHandler = function () { if (xhr.readyState === 4) { try { // touching statusCode in some platforms throws // an exception xhrInfo.status_code = xhr.status; } catch (e) { /* do nothing */ } triggerHandlers('xhr', { args, endTimestamp: Date.now(), startTimestamp: Date.now(), xhr, }); } }; if ('onreadystatechange' in xhr && typeof xhr.onreadystatechange === 'function') { (0,_object_js__WEBPACK_IMPORTED_MODULE_3__/* .fill */ .hl)(xhr, 'onreadystatechange', function (original) { return function (...readyStateArgs) { onreadystatechangeHandler(); return original.apply(xhr, readyStateArgs); }; }); } else { xhr.addEventListener('readystatechange', onreadystatechangeHandler); } return originalOpen.apply(xhr, args); }; }); (0,_object_js__WEBPACK_IMPORTED_MODULE_3__/* .fill */ .hl)(xhrproto, 'send', function (originalSend) { return function ( ...args) { if (this.__sentry_xhr__ && args[0] !== undefined) { this.__sentry_xhr__.body = args[0]; } triggerHandlers('xhr', { args, startTimestamp: Date.now(), xhr: this, }); return originalSend.apply(this, args); }; }); } let lastHref; /** JSDoc */ function instrumentHistory() { if (!(0,_supports_js__WEBPACK_IMPORTED_MODULE_4__/* .supportsHistory */ .Bf)()) { return; } var oldOnPopState = global.onpopstate; global.onpopstate = function ( ...args) { var to = global.location.href; // keep track of the current URL state, as we always receive only the updated state var from = lastHref; lastHref = to; triggerHandlers('history', { from, to, }); if (oldOnPopState) { // Apparently this can throw in Firefox when incorrectly implemented plugin is installed. // https://github.com/getsentry/sentry-javascript/issues/3344 // https://github.com/bugsnag/bugsnag-js/issues/469 try { return oldOnPopState.apply(this, args); } catch (_oO) { // no-empty } } }; /** @hidden */ function historyReplacementFunction(originalHistoryFunction) { return function ( ...args) { var url = args.length > 2 ? args[2] : undefined; if (url) { // coerce to string (this is what pushState does) var from = lastHref; var to = String(url); // keep track of the current URL state, as we always receive only the updated state lastHref = to; triggerHandlers('history', { from, to, }); } return originalHistoryFunction.apply(this, args); }; } (0,_object_js__WEBPACK_IMPORTED_MODULE_3__/* .fill */ .hl)(global.history, 'pushState', historyReplacementFunction); (0,_object_js__WEBPACK_IMPORTED_MODULE_3__/* .fill */ .hl)(global.history, 'replaceState', historyReplacementFunction); } var debounceDuration = 1000; let debounceTimerID; let lastCapturedEvent; /** * Decide whether the current event should finish the debounce of previously captured one. * @param previous previously captured event * @param current event to be captured */ function shouldShortcircuitPreviousDebounce(previous, current) { // If there was no previous event, it should always be swapped for the new one. if (!previous) { return true; } // If both events have different type, then user definitely performed two separate actions. e.g. click + keypress. if (previous.type !== current.type) { return true; } try { // If both events have the same type, it's still possible that actions were performed on different targets. // e.g. 2 clicks on different buttons. if (previous.target !== current.target) { return true; } } catch (e) { // just accessing `target` property can throw an exception in some rare circumstances // see: https://github.com/getsentry/sentry-javascript/issues/838 } // If both events have the same type _and_ same `target` (an element which triggered an event, _not necessarily_ // to which an event listener was attached), we treat them as the same action, as we want to capture // only one breadcrumb. e.g. multiple clicks on the same button, or typing inside a user input box. return false; } /** * Decide whether an event should be captured. * @param event event to be captured */ function shouldSkipDOMEvent(event) { // We are only interested in filtering `keypress` events for now. if (event.type !== 'keypress') { return false; } try { var target = event.target ; if (!target || !target.tagName) { return true; } // Only consider keypress events on actual input elements. This will disregard keypresses targeting body // e.g.tabbing through elements, hotkeys, etc. if (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA' || target.isContentEditable) { return false; } } catch (e) { // just accessing `target` property can throw an exception in some rare circumstances // see: https://github.com/getsentry/sentry-javascript/issues/838 } return true; } /** * Wraps addEventListener to capture UI breadcrumbs * @param handler function that will be triggered * @param globalListener indicates whether event was captured by the global event listener * @returns wrapped breadcrumb events handler * @hidden */ function makeDOMEventHandler(handler, globalListener = false) { return (event) => { // It's possible this handler might trigger multiple times for the same // event (e.g. event propagation through node ancestors). // Ignore if we've already captured that event. if (!event || lastCapturedEvent === event) { return; } // We always want to skip _some_ events. if (shouldSkipDOMEvent(event)) { return; } var name = event.type === 'keypress' ? 'input' : event.type; // If there is no debounce timer, it means that we can safely capture the new event and store it for future comparisons. if (debounceTimerID === undefined) { handler({ event: event, name, global: globalListener, }); lastCapturedEvent = event; } // If there is a debounce awaiting, see if the new event is different enough to treat it as a unique one. // If that's the case, emit the previous event and store locally the newly-captured DOM event. else if (shouldShortcircuitPreviousDebounce(lastCapturedEvent, event)) { handler({ event: event, name, global: globalListener, }); lastCapturedEvent = event; } // Start a new debounce timer that will prevent us from capturing multiple events that should be grouped together. clearTimeout(debounceTimerID); debounceTimerID = global.setTimeout(() => { debounceTimerID = undefined; }, debounceDuration); }; } /** JSDoc */ function instrumentDOM() { if (!('document' in global)) { return; } // Make it so that any click or keypress that is unhandled / bubbled up all the way to the document triggers our dom // handlers. (Normally we have only one, which captures a breadcrumb for each click or keypress.) Do this before // we instrument `addEventListener` so that we don't end up attaching this handler twice. var triggerDOMHandler = triggerHandlers.bind(null, 'dom'); var globalDOMEventHandler = makeDOMEventHandler(triggerDOMHandler, true); global.document.addEventListener('click', globalDOMEventHandler, false); global.document.addEventListener('keypress', globalDOMEventHandler, false); // After hooking into click and keypress events bubbled up to `document`, we also hook into user-handled // clicks & keypresses, by adding an event listener of our own to any element to which they add a listener. That // way, whenever one of their handlers is triggered, ours will be, too. (This is needed because their handler // could potentially prevent the event from bubbling up to our global listeners. This way, our handler are still // guaranteed to fire at least once.) ['EventTarget', 'Node'].forEach((target) => { var proto = (global )[target] && (global )[target].prototype; if (!proto || !proto.hasOwnProperty || !proto.hasOwnProperty('addEventListener')) { return; } (0,_object_js__WEBPACK_IMPORTED_MODULE_3__/* .fill */ .hl)(proto, 'addEventListener', function (originalAddEventListener) { return function ( type, listener, options, ) { if (type === 'click' || type == 'keypress') { try { var el = this ; var handlers = (el.__sentry_instrumentation_handlers__ = el.__sentry_instrumentation_handlers__ || {}); var handlerForType = (handlers[type] = handlers[type] || { refCount: 0 }); if (!handlerForType.handler) { var handler = makeDOMEventHandler(triggerDOMHandler); handlerForType.handler = handler; originalAddEventListener.call(this, type, handler, options); } handlerForType.refCount += 1; } catch (e) { // Accessing dom properties is always fragile. // Also allows us to skip `addEventListenrs` calls with no proper `this` context. } } return originalAddEventListener.call(this, type, listener, options); }; }); (0,_object_js__WEBPACK_IMPORTED_MODULE_3__/* .fill */ .hl)( proto, 'removeEventListener', function (originalRemoveEventListener) { return function ( type, listener, options, ) { if (type === 'click' || type == 'keypress') { try { var el = this ; var handlers = el.__sentry_instrumentation_handlers__ || {}; var handlerForType = handlers[type]; if (handlerForType) { handlerForType.refCount -= 1; // If there are no longer any custom handlers of the current type on this element, we can remove ours, too. if (handlerForType.refCount <= 0) { originalRemoveEventListener.call(this, type, handlerForType.handler, options); handlerForType.handler = undefined; delete handlers[type]; } // If there are no longer any custom handlers of any type on this element, cleanup everything. if (Object.keys(handlers).length === 0) { delete el.__sentry_instrumentation_handlers__; } } } catch (e) { // Accessing dom properties is always fragile. // Also allows us to skip `addEventListenrs` calls with no proper `this` context. } } return originalRemoveEventListener.call(this, type, listener, options); }; }, ); }); } let _oldOnErrorHandler = null; /** JSDoc */ function instrumentError() { _oldOnErrorHandler = global.onerror; global.onerror = function (msg, url, line, column, error) { triggerHandlers('error', { column, error, line, msg, url, }); if (_oldOnErrorHandler) { return _oldOnErrorHandler.apply(this, arguments); } return false; }; } let _oldOnUnhandledRejectionHandler = null; /** JSDoc */ function instrumentUnhandledRejection() { _oldOnUnhandledRejectionHandler = global.onunhandledrejection; global.onunhandledrejection = function (e) { triggerHandlers('unhandledrejection', e); if (_oldOnUnhandledRejectionHandler) { return _oldOnUnhandledRejectionHandler.apply(this, arguments); } return true; }; } //# sourceMappingURL=instrument.js.map /***/ }), /***/ 67597: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Cy": function() { return /* binding */ isSyntheticEvent; }, /* harmony export */ "HD": function() { return /* binding */ isString; }, /* harmony export */ "J8": function() { return /* binding */ isThenable; }, /* harmony export */ "Kj": function() { return /* binding */ isRegExp; }, /* harmony export */ "PO": function() { return /* binding */ isPlainObject; }, /* harmony export */ "TX": function() { return /* binding */ isDOMError; }, /* harmony export */ "V9": function() { return /* binding */ isInstanceOf; }, /* harmony export */ "VW": function() { return /* binding */ isErrorEvent; }, /* harmony export */ "VZ": function() { return /* binding */ isError; }, /* harmony export */ "cO": function() { return /* binding */ isEvent; }, /* harmony export */ "fm": function() { return /* binding */ isDOMException; }, /* harmony export */ "i2": function() { return /* binding */ isNaN; }, /* harmony export */ "kK": function() { return /* binding */ isElement; }, /* harmony export */ "pt": function() { return /* binding */ isPrimitive; } /* harmony export */ }); var objectToString = Object.prototype.toString; /** * Checks whether given value's type is one of a few Error or Error-like * {@link isError}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isError(wat) { switch (objectToString.call(wat)) { case '[object Error]': case '[object Exception]': case '[object DOMException]': return true; default: return isInstanceOf(wat, Error); } } function isBuiltin(wat, ty) { return objectToString.call(wat) === `[object ${ty}]`; } /** * Checks whether given value's type is ErrorEvent * {@link isErrorEvent}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isErrorEvent(wat) { return isBuiltin(wat, 'ErrorEvent'); } /** * Checks whether given value's type is DOMError * {@link isDOMError}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isDOMError(wat) { return isBuiltin(wat, 'DOMError'); } /** * Checks whether given value's type is DOMException * {@link isDOMException}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isDOMException(wat) { return isBuiltin(wat, 'DOMException'); } /** * Checks whether given value's type is a string * {@link isString}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isString(wat) { return isBuiltin(wat, 'String'); } /** * Checks whether given value is a primitive (undefined, null, number, boolean, string, bigint, symbol) * {@link isPrimitive}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isPrimitive(wat) { return wat === null || (typeof wat !== 'object' && typeof wat !== 'function'); } /** * Checks whether given value's type is an object literal * {@link isPlainObject}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isPlainObject(wat) { return isBuiltin(wat, 'Object'); } /** * Checks whether given value's type is an Event instance * {@link isEvent}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isEvent(wat) { return typeof Event !== 'undefined' && isInstanceOf(wat, Event); } /** * Checks whether given value's type is an Element instance * {@link isElement}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isElement(wat) { return typeof Element !== 'undefined' && isInstanceOf(wat, Element); } /** * Checks whether given value's type is an regexp * {@link isRegExp}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isRegExp(wat) { return isBuiltin(wat, 'RegExp'); } /** * Checks whether given value has a then function. * @param wat A value to be checked. */ function isThenable(wat) { return Boolean(wat && wat.then && typeof wat.then === 'function'); } /** * Checks whether given value's type is a SyntheticEvent * {@link isSyntheticEvent}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isSyntheticEvent(wat) { return isPlainObject(wat) && 'nativeEvent' in wat && 'preventDefault' in wat && 'stopPropagation' in wat; } /** * Checks whether given value is NaN * {@link isNaN}. * * @param wat A value to be checked. * @returns A boolean representing the result. */ function isNaN(wat) { return typeof wat === 'number' && wat !== wat; } /** * Checks whether given value's type is an instance of provided constructor. * {@link isInstanceOf}. * * @param wat A value to be checked. * @param base A constructor to be used in a check. * @returns A boolean representing the result. */ function isInstanceOf(wat, base) { try { return wat instanceof base; } catch (_e) { return false; } } //# sourceMappingURL=is.js.map /***/ }), /***/ 12343: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Cf": function() { return /* binding */ consoleSandbox; }, /* harmony export */ "RU": function() { return /* binding */ CONSOLE_LEVELS; }, /* harmony export */ "kg": function() { return /* binding */ logger; } /* harmony export */ }); /* harmony import */ var _global_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(82991); // TODO: Implement different loggers for different environments var global = (0,_global_js__WEBPACK_IMPORTED_MODULE_0__/* .getGlobalObject */ .R)(); /** Prefix for logging strings */ var PREFIX = 'Sentry Logger '; var CONSOLE_LEVELS = ['debug', 'info', 'warn', 'error', 'log', 'assert', 'trace'] ; /** * Temporarily disable sentry console instrumentations. * * @param callback The function to run against the original `console` messages * @returns The results of the callback */ function consoleSandbox(callback) { var global = (0,_global_js__WEBPACK_IMPORTED_MODULE_0__/* .getGlobalObject */ .R)(); if (!('console' in global)) { return callback(); } var originalConsole = global.console ; var wrappedLevels = {}; // Restore all wrapped console methods CONSOLE_LEVELS.forEach(level => { // TODO(v7): Remove this check as it's only needed for Node 6 var originalWrappedFunc = originalConsole[level] && (originalConsole[level] ).__sentry_original__; if (level in global.console && originalWrappedFunc) { wrappedLevels[level] = originalConsole[level] ; originalConsole[level] = originalWrappedFunc ; } }); try { return callback(); } finally { // Revert restoration to wrapped state Object.keys(wrappedLevels).forEach(level => { originalConsole[level] = wrappedLevels[level ]; }); } } function makeLogger() { let enabled = false; var logger = { enable: () => { enabled = true; }, disable: () => { enabled = false; }, }; if ((typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__)) { CONSOLE_LEVELS.forEach(name => { logger[name] = (...args) => { if (enabled) { consoleSandbox(() => { global.console[name](`${PREFIX}[${name}]:`, ...args); }); } }; }); } else { CONSOLE_LEVELS.forEach(name => { logger[name] = () => undefined; }); } return logger ; } // Ensure we only have a single logger instance, even if multiple versions of @sentry/utils are being used let logger; if ((typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__)) { logger = (0,_global_js__WEBPACK_IMPORTED_MODULE_0__/* .getGlobalSingleton */ .Y)('logger', makeLogger); } else { logger = makeLogger(); } //# sourceMappingURL=logger.js.map /***/ }), /***/ 62844: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "DM": function() { return /* binding */ uuid4; }, /* harmony export */ "Db": function() { return /* binding */ addExceptionTypeValue; }, /* harmony export */ "EG": function() { return /* binding */ addExceptionMechanism; }, /* harmony export */ "YO": function() { return /* binding */ checkOrSetAlreadyCaught; }, /* harmony export */ "jH": function() { return /* binding */ getEventDescription; } /* harmony export */ }); /* unused harmony exports addContextToFrame, parseSemver */ /* harmony import */ var _global_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(82991); /* harmony import */ var _object_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(20535); /** * Extended Window interface that allows for Crypto API usage in IE browsers */ /** * UUID4 generator * * @returns string Generated UUID4. */ function uuid4() { var global = (0,_global_js__WEBPACK_IMPORTED_MODULE_0__/* .getGlobalObject */ .R)() ; var crypto = (global.crypto || global.msCrypto) ; if (crypto && crypto.randomUUID) { return crypto.randomUUID().replace(/-/g, ''); } var getRandomByte = crypto && crypto.getRandomValues ? () => crypto.getRandomValues(new Uint8Array(1))[0] : () => Math.random() * 16; // http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#2117523 // Concatenating the following numbers as strings results in '10000000100040008000100000000000' return (([1e7] ) + 1e3 + 4e3 + 8e3 + 1e11).replace(/[018]/g, c => ((c ) ^ ((getRandomByte() & 15) >> ((c ) / 4))).toString(16), ); } function getFirstException(event) { return event.exception && event.exception.values ? event.exception.values[0] : undefined; } /** * Extracts either message or type+value from an event that can be used for user-facing logs * @returns event's description */ function getEventDescription(event) { const { message, event_id: eventId } = event; if (message) { return message; } var firstException = getFirstException(event); if (firstException) { if (firstException.type && firstException.value) { return `${firstException.type}: ${firstException.value}`; } return firstException.type || firstException.value || eventId || ''; } return eventId || ''; } /** * Adds exception values, type and value to an synthetic Exception. * @param event The event to modify. * @param value Value of the exception. * @param type Type of the exception. * @hidden */ function addExceptionTypeValue(event, value, type) { var exception = (event.exception = event.exception || {}); var values = (exception.values = exception.values || []); var firstException = (values[0] = values[0] || {}); if (!firstException.value) { firstException.value = value || ''; } if (!firstException.type) { firstException.type = type || 'Error'; } } /** * Adds exception mechanism data to a given event. Uses defaults if the second parameter is not passed. * * @param event The event to modify. * @param newMechanism Mechanism data to add to the event. * @hidden */ function addExceptionMechanism(event, newMechanism) { var firstException = getFirstException(event); if (!firstException) { return; } var defaultMechanism = { type: 'generic', handled: true }; var currentMechanism = firstException.mechanism; firstException.mechanism = { ...defaultMechanism, ...currentMechanism, ...newMechanism }; if (newMechanism && 'data' in newMechanism) { var mergedData = { ...(currentMechanism && currentMechanism.data), ...newMechanism.data }; firstException.mechanism.data = mergedData; } } // https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string var SEMVER_REGEXP = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/; /** * Represents Semantic Versioning object */ /** * Parses input into a SemVer interface * @param input string representation of a semver version */ function parseSemver(input) { var match = input.match(SEMVER_REGEXP) || []; var major = parseInt(match[1], 10); var minor = parseInt(match[2], 10); var patch = parseInt(match[3], 10); return { buildmetadata: match[5], major: isNaN(major) ? undefined : major, minor: isNaN(minor) ? undefined : minor, patch: isNaN(patch) ? undefined : patch, prerelease: match[4], }; } /** * This function adds context (pre/post/line) lines to the provided frame * * @param lines string[] containing all lines * @param frame StackFrame that will be mutated * @param linesOfContext number of context lines we want to add pre/post */ function addContextToFrame(lines, frame, linesOfContext = 5) { var lineno = frame.lineno || 0; var maxLines = lines.length; var sourceLine = Math.max(Math.min(maxLines, lineno - 1), 0); frame.pre_context = lines .slice(Math.max(0, sourceLine - linesOfContext), sourceLine) .map((line) => snipLine(line, 0)); frame.context_line = snipLine(lines[Math.min(maxLines - 1, sourceLine)], frame.colno || 0); frame.post_context = lines .slice(Math.min(sourceLine + 1, maxLines), sourceLine + 1 + linesOfContext) .map((line) => snipLine(line, 0)); } /** * Checks whether or not we've already captured the given exception (note: not an identical exception - the very object * in question), and marks it captured if not. * * This is useful because it's possible for an error to get captured by more than one mechanism. After we intercept and * record an error, we rethrow it (assuming we've intercepted it before it's reached the top-level global handlers), so * that we don't interfere with whatever effects the error might have had were the SDK not there. At that point, because * the error has been rethrown, it's possible for it to bubble up to some other code we've instrumented. If it's not * caught after that, it will bubble all the way up to the global handlers (which of course we also instrument). This * function helps us ensure that even if we encounter the same error more than once, we only record it the first time we * see it. * * Note: It will ignore primitives (always return `false` and not mark them as seen), as properties can't be set on * them. {@link: Object.objectify} can be used on exceptions to convert any that are primitives into their equivalent * object wrapper forms so that this check will always work. However, because we need to flag the exact object which * will get rethrown, and because that rethrowing happens outside of the event processing pipeline, the objectification * must be done before the exception captured. * * @param A thrown exception to check or flag as having been seen * @returns `true` if the exception has already been captured, `false` if not (with the side effect of marking it seen) */ function checkOrSetAlreadyCaught(exception) { if (exception && (exception ).__sentry_captured__) { return true; } try { // set it this way rather than by assignment so that it's not ennumerable and therefore isn't recorded by the // `ExtraErrorData` integration (0,_object_js__WEBPACK_IMPORTED_MODULE_1__/* .addNonEnumerableProperty */ .xp)(exception , '__sentry_captured__', true); } catch (err) { // `exception` is a primitive, so we can't mark it seen } return false; } //# sourceMappingURL=misc.js.map /***/ }), /***/ 92448: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { "l$": function() { return /* binding */ dynamicRequire; }, "KV": function() { return /* binding */ isNodeEnv; }, "$y": function() { return /* binding */ loadModule; } }); ;// CONCATENATED MODULE: ./node_modules/@sentry/utils/esm/env.js /* * This module exists for optimizations in the build process through rollup and terser. We define some global * constants, which can be overridden during build. By guarding certain pieces of code with functions that return these * constants, we can control whether or not they appear in the final bundle. (Any code guarded by a false condition will * never run, and will hence be dropped during treeshaking.) The two primary uses for this are stripping out calls to * `logger` and preventing node-related code from appearing in browser bundles. * * Attention: * This file should not be used to define constants/flags that are intended to be used for tree-shaking conducted by * users. These fags should live in their respective packages, as we identified user tooling (specifically webpack) * having issues tree-shaking these constants across package boundaries. * An example for this is the __SENTRY_DEBUG__ constant. It is declared in each package individually because we want * users to be able to shake away expressions that it guards. */ /** * Figures out if we're building a browser bundle. * * @returns true if this is a browser bundle build. */ function isBrowserBundle() { return typeof __SENTRY_BROWSER_BUNDLE__ !== 'undefined' && !!__SENTRY_BROWSER_BUNDLE__; } //# sourceMappingURL=env.js.map ;// CONCATENATED MODULE: ./node_modules/@sentry/utils/esm/node.js /* module decorator */ module = __webpack_require__.hmd(module); /* provided dependency */ var process = __webpack_require__(34155); /** * NOTE: In order to avoid circular dependencies, if you add a function to this module and it needs to print something, * you must either a) use `console.log` rather than the logger, or b) put your function elsewhere. */ /** * Checks whether we're in the Node.js or Browser environment * * @returns Answer to given question */ function isNodeEnv() { // explicitly check for browser bundles as those can be optimized statically // by terser/rollup. return ( !isBrowserBundle() && Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]' ); } /** * Requires a module which is protected against bundler minification. * * @param request The module path to resolve */ function dynamicRequire(mod, request) { return mod.require(request); } /** * Helper for dynamically loading module that should work with linked dependencies. * The problem is that we _should_ be using `require(require.resolve(moduleName, { paths: [cwd()] }))` * However it's _not possible_ to do that with Webpack, as it has to know all the dependencies during * build time. `require.resolve` is also not available in any other way, so we cannot create, * a fake helper like we do with `dynamicRequire`. * * We always prefer to use local package, thus the value is not returned early from each `try/catch` block. * That is to mimic the behavior of `require.resolve` exactly. * * @param moduleName module name to require * @returns possibly required module */ function loadModule(moduleName) { let mod; try { mod = dynamicRequire(module, moduleName); } catch (e) { // no-empty } try { const { cwd } = dynamicRequire(module, 'process'); mod = dynamicRequire(module, `${cwd()}/node_modules/${moduleName}`) ; } catch (e) { // no-empty } return mod; } //# sourceMappingURL=node.js.map /***/ }), /***/ 34754: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { "Fv": function() { return /* binding */ normalize; }, "Qy": function() { return /* binding */ normalizeToSize; } }); // UNUSED EXPORTS: walk // EXTERNAL MODULE: ./node_modules/@sentry/utils/esm/is.js var is = __webpack_require__(67597); ;// CONCATENATED MODULE: ./node_modules/@sentry/utils/esm/memo.js /** * Helper to decycle json objects */ function memoBuilder() { var hasWeakSet = typeof WeakSet === 'function'; var inner = hasWeakSet ? new WeakSet() : []; function memoize(obj) { if (hasWeakSet) { if (inner.has(obj)) { return true; } inner.add(obj); return false; } for (let i = 0; i < inner.length; i++) { var value = inner[i]; if (value === obj) { return true; } } inner.push(obj); return false; } function unmemoize(obj) { if (hasWeakSet) { inner.delete(obj); } else { for (let i = 0; i < inner.length; i++) { if (inner[i] === obj) { inner.splice(i, 1); break; } } } } return [memoize, unmemoize]; } //# sourceMappingURL=memo.js.map // EXTERNAL MODULE: ./node_modules/@sentry/utils/esm/object.js var object = __webpack_require__(20535); // EXTERNAL MODULE: ./node_modules/@sentry/utils/esm/stacktrace.js var stacktrace = __webpack_require__(30360); ;// CONCATENATED MODULE: ./node_modules/@sentry/utils/esm/normalize.js /** * Recursively normalizes the given object. * * - Creates a copy to prevent original input mutation * - Skips non-enumerable properties * - When stringifying, calls `toJSON` if implemented * - Removes circular references * - Translates non-serializable values (`undefined`/`NaN`/functions) to serializable format * - Translates known global objects/classes to a string representations * - Takes care of `Error` object serialization * - Optionally limits depth of final output * - Optionally limits number of properties/elements included in any single object/array * * @param input The object to be normalized. * @param depth The max depth to which to normalize the object. (Anything deeper stringified whole.) * @param maxProperties The max number of elements or properties to be included in any single array or * object in the normallized output.. * @returns A normalized version of the object, or `"**non-serializable**"` if any errors are thrown during normalization. */ function normalize(input, depth = +Infinity, maxProperties = +Infinity) { try { // since we're at the outermost level, we don't provide a key return visit('', input, depth, maxProperties); } catch (err) { return { ERROR: `**non-serializable** (${err})` }; } } /** JSDoc */ function normalizeToSize( object, // Default Node.js REPL depth depth = 3, // 100kB, as 200kB is max payload size, so half sounds reasonable maxSize = 100 * 1024, ) { var normalized = normalize(object, depth); if (jsonSize(normalized) > maxSize) { return normalizeToSize(object, depth - 1, maxSize); } return normalized ; } /** * Visits a node to perform normalization on it * * @param key The key corresponding to the given node * @param value The node to be visited * @param depth Optional number indicating the maximum recursion depth * @param maxProperties Optional maximum number of properties/elements included in any single object/array * @param memo Optional Memo class handling decycling */ function visit( key, value, depth = +Infinity, maxProperties = +Infinity, memo = memoBuilder(), ) { const [memoize, unmemoize] = memo; // Get the simple cases out of the way first if (value === null || (['number', 'boolean', 'string'].includes(typeof value) && !(0,is/* isNaN */.i2)(value))) { return value ; } var stringified = stringifyValue(key, value); // Anything we could potentially dig into more (objects or arrays) will have come back as `"[object XXXX]"`. // Everything else will have already been serialized, so if we don't see that pattern, we're done. if (!stringified.startsWith('[object ')) { return stringified; } // From here on, we can assert that `value` is either an object or an array. // Do not normalize objects that we know have already been normalized. As a general rule, the // "__sentry_skip_normalization__" property should only be used sparingly and only should only be set on objects that // have already been normalized. if ((value )['__sentry_skip_normalization__']) { return value ; } // We're also done if we've reached the max depth if (depth === 0) { // At this point we know `serialized` is a string of the form `"[object XXXX]"`. Clean it up so it's just `"[XXXX]"`. return stringified.replace('object ', ''); } // If we've already visited this branch, bail out, as it's circular reference. If not, note that we're seeing it now. if (memoize(value)) { return '[Circular ~]'; } // If the value has a `toJSON` method, we call it to extract more information var valueWithToJSON = value ; if (valueWithToJSON && typeof valueWithToJSON.toJSON === 'function') { try { var jsonValue = valueWithToJSON.toJSON(); // We need to normalize the return value of `.toJSON()` in case it has circular references return visit('', jsonValue, depth - 1, maxProperties, memo); } catch (err) { // pass (The built-in `toJSON` failed, but we can still try to do it ourselves) } } // At this point we know we either have an object or an array, we haven't seen it before, and we're going to recurse // because we haven't yet reached the max depth. Create an accumulator to hold the results of visiting each // property/entry, and keep track of the number of items we add to it. var normalized = (Array.isArray(value) ? [] : {}) ; let numAdded = 0; // Before we begin, convert`Error` and`Event` instances into plain objects, since some of each of their relevant // properties are non-enumerable and otherwise would get missed. var visitable = (0,object/* convertToPlainObject */.Sh)(value ); for (var visitKey in visitable) { // Avoid iterating over fields in the prototype if they've somehow been exposed to enumeration. if (!Object.prototype.hasOwnProperty.call(visitable, visitKey)) { continue; } if (numAdded >= maxProperties) { normalized[visitKey] = '[MaxProperties ~]'; break; } // Recursively visit all the child nodes var visitValue = visitable[visitKey]; normalized[visitKey] = visit(visitKey, visitValue, depth - 1, maxProperties, memo); numAdded += 1; } // Once we've visited all the branches, remove the parent from memo storage unmemoize(value); // Return accumulated values return normalized; } /** * Stringify the given value. Handles various known special values and types. * * Not meant to be used on simple primitives which already have a string representation, as it will, for example, turn * the number 1231 into "[Object Number]", nor on `null`, as it will throw. * * @param value The value to stringify * @returns A stringified representation of the given value */ function stringifyValue( key, // this type is a tiny bit of a cheat, since this function does handle NaN (which is technically a number), but for // our internal use, it'll do value, ) { try { if (key === 'domain' && value && typeof value === 'object' && (value )._events) { return '[Domain]'; } if (key === 'domainEmitter') { return '[DomainEmitter]'; } // It's safe to use `global`, `window`, and `document` here in this manner, as we are asserting using `typeof` first // which won't throw if they are not present. if (typeof __webpack_require__.g !== 'undefined' && value === __webpack_require__.g) { return '[Global]'; } if (typeof window !== 'undefined' && value === window) { return '[Window]'; } if (typeof document !== 'undefined' && value === document) { return '[Document]'; } // React's SyntheticEvent thingy if ((0,is/* isSyntheticEvent */.Cy)(value)) { return '[SyntheticEvent]'; } if (typeof value === 'number' && value !== value) { return '[NaN]'; } // this catches `undefined` (but not `null`, which is a primitive and can be serialized on its own) if (value === void 0) { return '[undefined]'; } if (typeof value === 'function') { return `[Function: ${(0,stacktrace/* getFunctionName */.$P)(value)}]`; } if (typeof value === 'symbol') { return `[${String(value)}]`; } // stringified BigInts are indistinguishable from regular numbers, so we need to label them to avoid confusion if (typeof value === 'bigint') { return `[BigInt: ${String(value)}]`; } // Now that we've knocked out all the special cases and the primitives, all we have left are objects. Simply casting // them to strings means that instances of classes which haven't defined their `toStringTag` will just come out as // `"[object Object]"`. If we instead look at the constructor's name (which is the same as the name of the class), // we can make sure that only plain objects come out that way. return `[object ${(Object.getPrototypeOf(value) ).constructor.name}]`; } catch (err) { return `**non-serializable** (${err})`; } } /** Calculates bytes size of input string */ function utf8Length(value) { return ~-encodeURI(value).split(/%..|./).length; } /** Calculates bytes size of input object */ function jsonSize(value) { return utf8Length(JSON.stringify(value)); } //# sourceMappingURL=normalize.js.map /***/ }), /***/ 20535: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "$Q": function() { return /* binding */ markFunctionWrapped; }, /* harmony export */ "HK": function() { return /* binding */ getOriginalFunction; }, /* harmony export */ "Jr": function() { return /* binding */ dropUndefinedKeys; }, /* harmony export */ "Sh": function() { return /* binding */ convertToPlainObject; }, /* harmony export */ "_j": function() { return /* binding */ urlEncode; }, /* harmony export */ "hl": function() { return /* binding */ fill; }, /* harmony export */ "xp": function() { return /* binding */ addNonEnumerableProperty; }, /* harmony export */ "zf": function() { return /* binding */ extractExceptionKeysForMessage; } /* harmony export */ }); /* unused harmony export objectify */ /* harmony import */ var _browser_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(58464); /* harmony import */ var _is_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(67597); /* harmony import */ var _string_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(57321); /** * Replace a method in an object with a wrapped version of itself. * * @param source An object that contains a method to be wrapped. * @param name The name of the method to be wrapped. * @param replacementFactory A higher-order function that takes the original version of the given method and returns a * wrapped version. Note: The function returned by `replacementFactory` needs to be a non-arrow function, in order to * preserve the correct value of `this`, and the original method must be called using `origMethod.call(this, )` or `origMethod.apply(this, [])` (rather than being called directly), again to preserve `this`. * @returns void */ function fill(source, name, replacementFactory) { if (!(name in source)) { return; } var original = source[name] ; var wrapped = replacementFactory(original) ; // Make sure it's a function first, as we need to attach an empty prototype for `defineProperties` to work // otherwise it'll throw "TypeError: Object.defineProperties called on non-object" if (typeof wrapped === 'function') { try { markFunctionWrapped(wrapped, original); } catch (_Oo) { // This can throw if multiple fill happens on a global object like XMLHttpRequest // Fixes https://github.com/getsentry/sentry-javascript/issues/2043 } } source[name] = wrapped; } /** * Defines a non-enumerable property on the given object. * * @param obj The object on which to set the property * @param name The name of the property to be set * @param value The value to which to set the property */ function addNonEnumerableProperty(obj, name, value) { Object.defineProperty(obj, name, { // enumerable: false, // the default, so we can save on bundle size by not explicitly setting it value: value, writable: true, configurable: true, }); } /** * Remembers the original function on the wrapped function and * patches up the prototype. * * @param wrapped the wrapper function * @param original the original function that gets wrapped */ function markFunctionWrapped(wrapped, original) { var proto = original.prototype || {}; wrapped.prototype = original.prototype = proto; addNonEnumerableProperty(wrapped, '__sentry_original__', original); } /** * This extracts the original function if available. See * `markFunctionWrapped` for more information. * * @param func the function to unwrap * @returns the unwrapped version of the function if available. */ function getOriginalFunction(func) { return func.__sentry_original__; } /** * Encodes given object into url-friendly format * * @param object An object that contains serializable values * @returns string Encoded */ function urlEncode(object) { return Object.keys(object) .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(object[key])}`) .join('&'); } /** * Transforms any `Error` or `Event` into a plain object with all of their enumerable properties, and some of their * non-enumerable properties attached. * * @param value Initial source that we have to transform in order for it to be usable by the serializer * @returns An Event or Error turned into an object - or the value argurment itself, when value is neither an Event nor * an Error. */ function convertToPlainObject( value, ) { if ((0,_is_js__WEBPACK_IMPORTED_MODULE_0__/* .isError */ .VZ)(value)) { return { message: value.message, name: value.name, stack: value.stack, ...getOwnProperties(value), }; } else if ((0,_is_js__WEBPACK_IMPORTED_MODULE_0__/* .isEvent */ .cO)(value)) { var newObj = { type: value.type, target: serializeEventTarget(value.target), currentTarget: serializeEventTarget(value.currentTarget), ...getOwnProperties(value), }; if (typeof CustomEvent !== 'undefined' && (0,_is_js__WEBPACK_IMPORTED_MODULE_0__/* .isInstanceOf */ .V9)(value, CustomEvent)) { newObj.detail = value.detail; } return newObj; } else { return value; } } /** Creates a string representation of the target of an `Event` object */ function serializeEventTarget(target) { try { return (0,_is_js__WEBPACK_IMPORTED_MODULE_0__/* .isElement */ .kK)(target) ? (0,_browser_js__WEBPACK_IMPORTED_MODULE_1__/* .htmlTreeAsString */ .R)(target) : Object.prototype.toString.call(target); } catch (_oO) { return ''; } } /** Filters out all but an object's own properties */ function getOwnProperties(obj) { if (typeof obj === 'object' && obj !== null) { var extractedProps = {}; for (var property in obj) { if (Object.prototype.hasOwnProperty.call(obj, property)) { extractedProps[property] = (obj )[property]; } } return extractedProps; } else { return {}; } } /** * Given any captured exception, extract its keys and create a sorted * and truncated list that will be used inside the event message. * eg. `Non-error exception captured with keys: foo, bar, baz` */ function extractExceptionKeysForMessage(exception, maxLength = 40) { var keys = Object.keys(convertToPlainObject(exception)); keys.sort(); if (!keys.length) { return '[object has no keys]'; } if (keys[0].length >= maxLength) { return (0,_string_js__WEBPACK_IMPORTED_MODULE_2__/* .truncate */ .$G)(keys[0], maxLength); } for (let includedKeys = keys.length; includedKeys > 0; includedKeys--) { var serialized = keys.slice(0, includedKeys).join(', '); if (serialized.length > maxLength) { continue; } if (includedKeys === keys.length) { return serialized; } return (0,_string_js__WEBPACK_IMPORTED_MODULE_2__/* .truncate */ .$G)(serialized, maxLength); } return ''; } /** * Given any object, return a new object having removed all fields whose value was `undefined`. * Works recursively on objects and arrays. * * Attention: This function keeps circular references in the returned object. */ function dropUndefinedKeys(inputValue) { // This map keeps track of what already visited nodes map to. // Our Set - based memoBuilder doesn't work here because we want to the output object to have the same circular // references as the input object. var memoizationMap = new Map(); // This function just proxies `_dropUndefinedKeys` to keep the `memoBuilder` out of this function's API return _dropUndefinedKeys(inputValue, memoizationMap); } function _dropUndefinedKeys(inputValue, memoizationMap) { if ((0,_is_js__WEBPACK_IMPORTED_MODULE_0__/* .isPlainObject */ .PO)(inputValue)) { // If this node has already been visited due to a circular reference, return the object it was mapped to in the new object var memoVal = memoizationMap.get(inputValue); if (memoVal !== undefined) { return memoVal ; } var returnValue = {}; // Store the mapping of this value in case we visit it again, in case of circular data memoizationMap.set(inputValue, returnValue); for (var key of Object.keys(inputValue)) { if (typeof inputValue[key] !== 'undefined') { returnValue[key] = _dropUndefinedKeys(inputValue[key], memoizationMap); } } return returnValue ; } if (Array.isArray(inputValue)) { // If this node has already been visited due to a circular reference, return the array it was mapped to in the new object var memoVal = memoizationMap.get(inputValue); if (memoVal !== undefined) { return memoVal ; } var returnValue = []; // Store the mapping of this value in case we visit it again, in case of circular data memoizationMap.set(inputValue, returnValue); inputValue.forEach((item) => { returnValue.push(_dropUndefinedKeys(item, memoizationMap)); }); return returnValue ; } return inputValue; } /** * Ensure that something is an object. * * Turns `undefined` and `null` into `String`s and all other primitives into instances of their respective wrapper * classes (String, Boolean, Number, etc.). Acts as the identity function on non-primitives. * * @param wat The subject of the objectification * @returns A version of `wat` which can safely be used with `Object` class methods */ function objectify(wat) { let objectified; switch (true) { case wat === undefined || wat === null: objectified = new String(wat); break; // Though symbols and bigints do have wrapper classes (`Symbol` and `BigInt`, respectively), for whatever reason // those classes don't have constructors which can be used with the `new` keyword. We therefore need to cast each as // an object in order to wrap it. case typeof wat === 'symbol' || typeof wat === 'bigint': objectified = Object(wat); break; // this will catch the remaining primitives: `String`, `Number`, and `Boolean` case isPrimitive(wat): objectified = new (wat ).constructor(wat); break; // by process of elimination, at this point we know that `wat` must already be an object default: objectified = wat; break; } return objectified; } //# sourceMappingURL=object.js.map /***/ }), /***/ 30360: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "$P": function() { return /* binding */ getFunctionName; }, /* harmony export */ "Sq": function() { return /* binding */ stackParserFromStackParserOptions; }, /* harmony export */ "pE": function() { return /* binding */ createStackParser; } /* harmony export */ }); /* unused harmony exports nodeStackLineParser, stripSentryFramesAndReverse */ var STACKTRACE_LIMIT = 50; /** * Creates a stack parser with the supplied line parsers * * StackFrames are returned in the correct order for Sentry Exception * frames and with Sentry SDK internal frames removed from the top and bottom * */ function createStackParser(...parsers) { var sortedParsers = parsers.sort((a, b) => a[0] - b[0]).map(p => p[1]); return (stack, skipFirst = 0) => { var frames = []; for (var line of stack.split('\n').slice(skipFirst)) { // https://github.com/getsentry/sentry-javascript/issues/5459 // Remove webpack (error: *) wrappers var cleanedLine = line.replace(/\(error: (.*)\)/, '$1'); for (var parser of sortedParsers) { var frame = parser(cleanedLine); if (frame) { frames.push(frame); break; } } } return stripSentryFramesAndReverse(frames); }; } /** * Gets a stack parser implementation from Options.stackParser * @see Options * * If options contains an array of line parsers, it is converted into a parser */ function stackParserFromStackParserOptions(stackParser) { if (Array.isArray(stackParser)) { return createStackParser(...stackParser); } return stackParser; } /** * @hidden */ function stripSentryFramesAndReverse(stack) { if (!stack.length) { return []; } let localStack = stack; var firstFrameFunction = localStack[0].function || ''; var lastFrameFunction = localStack[localStack.length - 1].function || ''; // If stack starts with one of our API calls, remove it (starts, meaning it's the top of the stack - aka last call) if (firstFrameFunction.indexOf('captureMessage') !== -1 || firstFrameFunction.indexOf('captureException') !== -1) { localStack = localStack.slice(1); } // If stack ends with one of our internal API calls, remove it (ends, meaning it's the bottom of the stack - aka top-most call) if (lastFrameFunction.indexOf('sentryWrapped') !== -1) { localStack = localStack.slice(0, -1); } // The frame where the crash happened, should be the last entry in the array return localStack .slice(0, STACKTRACE_LIMIT) .map(frame => ({ ...frame, filename: frame.filename || localStack[0].filename, function: frame.function || '?', })) .reverse(); } var defaultFunctionName = ''; /** * Safely extract function name from itself */ function getFunctionName(fn) { try { if (!fn || typeof fn !== 'function') { return defaultFunctionName; } return fn.name || defaultFunctionName; } catch (e) { // Just accessing custom props in some Selenium environments // can cause a "Permission denied" exception (see raven-js#495). return defaultFunctionName; } } function node(getModule) { var FILENAME_MATCH = /^\s*[-]{4,}$/; var FULL_MATCH = /at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/; return (line) => { if (line.match(FILENAME_MATCH)) { return { filename: line, }; } var lineMatch = line.match(FULL_MATCH); if (!lineMatch) { return undefined; } let object; let method; let functionName; let typeName; let methodName; if (lineMatch[1]) { functionName = lineMatch[1]; let methodStart = functionName.lastIndexOf('.'); if (functionName[methodStart - 1] === '.') { methodStart--; } if (methodStart > 0) { object = functionName.substr(0, methodStart); method = functionName.substr(methodStart + 1); var objectEnd = object.indexOf('.Module'); if (objectEnd > 0) { functionName = functionName.substr(objectEnd + 1); object = object.substr(0, objectEnd); } } typeName = undefined; } if (method) { typeName = object; methodName = method; } if (method === '') { methodName = undefined; functionName = undefined; } if (functionName === undefined) { methodName = methodName || ''; functionName = typeName ? `${typeName}.${methodName}` : methodName; } var filename = _optionalChain([lineMatch, 'access', _ => _[2], 'optionalAccess', _2 => _2.startsWith, 'call', _3 => _3('file://')]) ? lineMatch[2].substr(7) : lineMatch[2]; var isNative = lineMatch[5] === 'native'; var isInternal = isNative || (filename && !filename.startsWith('/') && !filename.startsWith('.') && filename.indexOf(':\\') !== 1); // in_app is all that's not an internal Node function or a module within node_modules // note that isNative appears to return true even for node core libraries // see https://github.com/getsentry/raven-node/issues/176 var in_app = !isInternal && filename !== undefined && !filename.includes('node_modules/'); return { filename, module: _optionalChain([getModule, 'optionalCall', _4 => _4(filename)]), function: functionName, lineno: parseInt(lineMatch[3], 10) || undefined, colno: parseInt(lineMatch[4], 10) || undefined, in_app, }; }; } /** * Node.js stack line parser * * This is in @sentry/utils so it can be used from the Electron SDK in the browser for when `nodeIntegration == true`. * This allows it to be used without referencing or importing any node specific code which causes bundlers to complain */ function nodeStackLineParser(getModule) { return [90, node(getModule)]; } //# sourceMappingURL=stacktrace.js.map /***/ }), /***/ 57321: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "$G": function() { return /* binding */ truncate; }, /* harmony export */ "nK": function() { return /* binding */ safeJoin; }, /* harmony export */ "zC": function() { return /* binding */ isMatchingPattern; } /* harmony export */ }); /* unused harmony exports escapeStringForRegex, snipLine */ /* harmony import */ var _is_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(67597); /** * Truncates given string to the maximum characters count * * @param str An object that contains serializable values * @param max Maximum number of characters in truncated string (0 = unlimited) * @returns string Encoded */ function truncate(str, max = 0) { if (typeof str !== 'string' || max === 0) { return str; } return str.length <= max ? str : `${str.substr(0, max)}...`; } /** * This is basically just `trim_line` from * https://github.com/getsentry/sentry/blob/master/src/sentry/lang/javascript/processor.py#L67 * * @param str An object that contains serializable values * @param max Maximum number of characters in truncated string * @returns string Encoded */ function snipLine(line, colno) { let newLine = line; var lineLength = newLine.length; if (lineLength <= 150) { return newLine; } if (colno > lineLength) { colno = lineLength; } let start = Math.max(colno - 60, 0); if (start < 5) { start = 0; } let end = Math.min(start + 140, lineLength); if (end > lineLength - 5) { end = lineLength; } if (end === lineLength) { start = Math.max(end - 140, 0); } newLine = newLine.slice(start, end); if (start > 0) { newLine = `'{snip} ${newLine}`; } if (end < lineLength) { newLine += ' {snip}'; } return newLine; } /** * Join values in array * @param input array of values to be joined together * @param delimiter string to be placed in-between values * @returns Joined values */ function safeJoin(input, delimiter) { if (!Array.isArray(input)) { return ''; } var output = []; for (let i = 0; i < input.length; i++) { var value = input[i]; try { output.push(String(value)); } catch (e) { output.push('[value cannot be serialized]'); } } return output.join(delimiter); } /** * Checks if the value matches a regex or includes the string * @param value The string value to be checked against * @param pattern Either a regex or a string that must be contained in value */ function isMatchingPattern(value, pattern) { if (!(0,_is_js__WEBPACK_IMPORTED_MODULE_0__/* .isString */ .HD)(value)) { return false; } if ((0,_is_js__WEBPACK_IMPORTED_MODULE_0__/* .isRegExp */ .Kj)(pattern)) { return pattern.test(value); } if (typeof pattern === 'string') { return value.indexOf(pattern) !== -1; } return false; } /** * Given a string, escape characters which have meaning in the regex grammar, such that the result is safe to feed to * `new RegExp()`. * * Based on https://github.com/sindresorhus/escape-string-regexp. Vendored to a) reduce the size by skipping the runtime * type-checking, and b) ensure it gets down-compiled for old versions of Node (the published package only supports Node * 12+). * * @param regexString The string to escape * @returns An version of the string with all special regex characters escaped */ function escapeStringForRegex(regexString) { // escape the hyphen separately so we can also replace it with a unicode literal hyphen, to avoid the problems // discussed in https://github.com/sindresorhus/escape-string-regexp/issues/20. return regexString.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d'); } //# sourceMappingURL=string.js.map /***/ }), /***/ 8823: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Ak": function() { return /* binding */ supportsFetch; }, /* harmony export */ "Bf": function() { return /* binding */ supportsHistory; }, /* harmony export */ "Du": function() { return /* binding */ isNativeFetch; }, /* harmony export */ "t$": function() { return /* binding */ supportsNativeFetch; } /* harmony export */ }); /* unused harmony exports supportsDOMError, supportsDOMException, supportsErrorEvent, supportsReferrerPolicy, supportsReportingObserver */ /* harmony import */ var _global_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(82991); /* harmony import */ var _logger_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(12343); /** * Tells whether current environment supports ErrorEvent objects * {@link supportsErrorEvent}. * * @returns Answer to the given question. */ function supportsErrorEvent() { try { new ErrorEvent(''); return true; } catch (e) { return false; } } /** * Tells whether current environment supports DOMError objects * {@link supportsDOMError}. * * @returns Answer to the given question. */ function supportsDOMError() { try { // Chrome: VM89:1 Uncaught TypeError: Failed to construct 'DOMError': // 1 argument required, but only 0 present. // @ts-ignore It really needs 1 argument, not 0. new DOMError(''); return true; } catch (e) { return false; } } /** * Tells whether current environment supports DOMException objects * {@link supportsDOMException}. * * @returns Answer to the given question. */ function supportsDOMException() { try { new DOMException(''); return true; } catch (e) { return false; } } /** * Tells whether current environment supports Fetch API * {@link supportsFetch}. * * @returns Answer to the given question. */ function supportsFetch() { if (!('fetch' in (0,_global_js__WEBPACK_IMPORTED_MODULE_0__/* .getGlobalObject */ .R)())) { return false; } try { new Headers(); new Request(''); new Response(); return true; } catch (e) { return false; } } /** * isNativeFetch checks if the given function is a native implementation of fetch() */ function isNativeFetch(func) { return func && /^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(func.toString()); } /** * Tells whether current environment supports Fetch API natively * {@link supportsNativeFetch}. * * @returns true if `window.fetch` is natively implemented, false otherwise */ function supportsNativeFetch() { if (!supportsFetch()) { return false; } var global = (0,_global_js__WEBPACK_IMPORTED_MODULE_0__/* .getGlobalObject */ .R)(); // Fast path to avoid DOM I/O if (isNativeFetch(global.fetch)) { return true; } // window.fetch is implemented, but is polyfilled or already wrapped (e.g: by a chrome extension) // so create a "pure" iframe to see if that has native fetch let result = false; var doc = global.document; if (doc && typeof (doc.createElement ) === 'function') { try { var sandbox = doc.createElement('iframe'); sandbox.hidden = true; doc.head.appendChild(sandbox); if (sandbox.contentWindow && sandbox.contentWindow.fetch) { result = isNativeFetch(sandbox.contentWindow.fetch); } doc.head.removeChild(sandbox); } catch (err) { (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _logger_js__WEBPACK_IMPORTED_MODULE_1__/* .logger.warn */ .kg.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ', err); } } return result; } /** * Tells whether current environment supports ReportingObserver API * {@link supportsReportingObserver}. * * @returns Answer to the given question. */ function supportsReportingObserver() { return 'ReportingObserver' in getGlobalObject(); } /** * Tells whether current environment supports Referrer Policy API * {@link supportsReferrerPolicy}. * * @returns Answer to the given question. */ function supportsReferrerPolicy() { // Despite all stars in the sky saying that Edge supports old draft syntax, aka 'never', 'always', 'origin' and 'default' // (see https://caniuse.com/#feat=referrer-policy), // it doesn't. And it throws an exception instead of ignoring this parameter... // REF: https://github.com/getsentry/raven-js/issues/1233 if (!supportsFetch()) { return false; } try { new Request('_', { referrerPolicy: 'origin' , }); return true; } catch (e) { return false; } } /** * Tells whether current environment supports History API * {@link supportsHistory}. * * @returns Answer to the given question. */ function supportsHistory() { // NOTE: in Chrome App environment, touching history.pushState, *even inside // a try/catch block*, will cause Chrome to output an error to console.error // borrowed from: https://github.com/angular/angular.js/pull/13945/files var global = (0,_global_js__WEBPACK_IMPORTED_MODULE_0__/* .getGlobalObject */ .R)(); var chrome = (global ).chrome; var isChromePackagedApp = chrome && chrome.app && chrome.app.runtime; var hasHistoryApi = 'history' in global && !!global.history.pushState && !!global.history.replaceState; return !isChromePackagedApp && hasHistoryApi; } //# sourceMappingURL=supports.js.map /***/ }), /***/ 96893: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "$2": function() { return /* binding */ rejectedSyncPromise; }, /* harmony export */ "WD": function() { return /* binding */ resolvedSyncPromise; }, /* harmony export */ "cW": function() { return /* binding */ SyncPromise; } /* harmony export */ }); /* harmony import */ var _is_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(67597); /** SyncPromise internal states */ var States; (function (States) { /** Pending */ var PENDING = 0; States[States["PENDING"] = PENDING] = "PENDING"; /** Resolved / OK */ var RESOLVED = 1; States[States["RESOLVED"] = RESOLVED] = "RESOLVED"; /** Rejected / Error */ var REJECTED = 2; States[States["REJECTED"] = REJECTED] = "REJECTED"; })(States || (States = {})); // Overloads so we can call resolvedSyncPromise without arguments and generic argument /** * Creates a resolved sync promise. * * @param value the value to resolve the promise with * @returns the resolved sync promise */ function resolvedSyncPromise(value) { return new SyncPromise(resolve => { resolve(value); }); } /** * Creates a rejected sync promise. * * @param value the value to reject the promise with * @returns the rejected sync promise */ function rejectedSyncPromise(reason) { return new SyncPromise((_, reject) => { reject(reason); }); } /** * Thenable class that behaves like a Promise and follows it's interface * but is not async internally */ class SyncPromise { __init() {this._state = States.PENDING;} __init2() {this._handlers = [];} constructor( executor, ) {;SyncPromise.prototype.__init.call(this);SyncPromise.prototype.__init2.call(this);SyncPromise.prototype.__init3.call(this);SyncPromise.prototype.__init4.call(this);SyncPromise.prototype.__init5.call(this);SyncPromise.prototype.__init6.call(this); try { executor(this._resolve, this._reject); } catch (e) { this._reject(e); } } /** JSDoc */ then( onfulfilled, onrejected, ) { return new SyncPromise((resolve, reject) => { this._handlers.push([ false, result => { if (!onfulfilled) { // TODO: ¯\_(ツ)_/¯ // TODO: FIXME resolve(result ); } else { try { resolve(onfulfilled(result)); } catch (e) { reject(e); } } }, reason => { if (!onrejected) { reject(reason); } else { try { resolve(onrejected(reason)); } catch (e) { reject(e); } } }, ]); this._executeHandlers(); }); } /** JSDoc */ catch( onrejected, ) { return this.then(val => val, onrejected); } /** JSDoc */ finally(onfinally) { return new SyncPromise((resolve, reject) => { let val; let isRejected; return this.then( value => { isRejected = false; val = value; if (onfinally) { onfinally(); } }, reason => { isRejected = true; val = reason; if (onfinally) { onfinally(); } }, ).then(() => { if (isRejected) { reject(val); return; } resolve(val ); }); }); } /** JSDoc */ __init3() {this._resolve = (value) => { this._setResult(States.RESOLVED, value); };} /** JSDoc */ __init4() {this._reject = (reason) => { this._setResult(States.REJECTED, reason); };} /** JSDoc */ __init5() {this._setResult = (state, value) => { if (this._state !== States.PENDING) { return; } if ((0,_is_js__WEBPACK_IMPORTED_MODULE_0__/* .isThenable */ .J8)(value)) { void (value ).then(this._resolve, this._reject); return; } this._state = state; this._value = value; this._executeHandlers(); };} /** JSDoc */ __init6() {this._executeHandlers = () => { if (this._state === States.PENDING) { return; } var cachedHandlers = this._handlers.slice(); this._handlers = []; cachedHandlers.forEach(handler => { if (handler[0]) { return; } if (this._state === States.RESOLVED) { handler[1](this._value ); } if (this._state === States.REJECTED) { handler[2](this._value); } handler[0] = true; }); };} } //# sourceMappingURL=syncpromise.js.map /***/ }), /***/ 21170: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Z1": function() { return /* binding */ browserPerformanceTimeOrigin; }, /* harmony export */ "_I": function() { return /* binding */ timestampWithMs; }, /* harmony export */ "ph": function() { return /* binding */ timestampInSeconds; }, /* harmony export */ "yW": function() { return /* binding */ dateTimestampInSeconds; } /* harmony export */ }); /* unused harmony exports _browserPerformanceTimeOriginMode, usingPerformanceAPI */ /* harmony import */ var _global_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(82991); /* harmony import */ var _node_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(92448); /* module decorator */ module = __webpack_require__.hmd(module); /** * An object that can return the current timestamp in seconds since the UNIX epoch. */ /** * A TimestampSource implementation for environments that do not support the Performance Web API natively. * * Note that this TimestampSource does not use a monotonic clock. A call to `nowSeconds` may return a timestamp earlier * than a previously returned value. We do not try to emulate a monotonic behavior in order to facilitate debugging. It * is more obvious to explain "why does my span have negative duration" than "why my spans have zero duration". */ var dateTimestampSource = { nowSeconds: () => Date.now() / 1000, }; /** * A partial definition of the [Performance Web API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Performance} * for accessing a high-resolution monotonic clock. */ /** * Returns a wrapper around the native Performance API browser implementation, or undefined for browsers that do not * support the API. * * Wrapping the native API works around differences in behavior from different browsers. */ function getBrowserPerformance() { const { performance } = (0,_global_js__WEBPACK_IMPORTED_MODULE_0__/* .getGlobalObject */ .R)(); if (!performance || !performance.now) { return undefined; } // Replace performance.timeOrigin with our own timeOrigin based on Date.now(). // // This is a partial workaround for browsers reporting performance.timeOrigin such that performance.timeOrigin + // performance.now() gives a date arbitrarily in the past. // // Additionally, computing timeOrigin in this way fills the gap for browsers where performance.timeOrigin is // undefined. // // The assumption that performance.timeOrigin + performance.now() ~= Date.now() is flawed, but we depend on it to // interact with data coming out of performance entries. // // Note that despite recommendations against it in the spec, browsers implement the Performance API with a clock that // might stop when the computer is asleep (and perhaps under other circumstances). Such behavior causes // performance.timeOrigin + performance.now() to have an arbitrary skew over Date.now(). In laptop computers, we have // observed skews that can be as long as days, weeks or months. // // See https://github.com/getsentry/sentry-javascript/issues/2590. // // BUG: despite our best intentions, this workaround has its limitations. It mostly addresses timings of pageload // transactions, but ignores the skew built up over time that can aversely affect timestamps of navigation // transactions of long-lived web pages. var timeOrigin = Date.now() - performance.now(); return { now: () => performance.now(), timeOrigin, }; } /** * Returns the native Performance API implementation from Node.js. Returns undefined in old Node.js versions that don't * implement the API. */ function getNodePerformance() { try { var perfHooks = (0,_node_js__WEBPACK_IMPORTED_MODULE_1__/* .dynamicRequire */ .l$)(module, 'perf_hooks') ; return perfHooks.performance; } catch (_) { return undefined; } } /** * The Performance API implementation for the current platform, if available. */ var platformPerformance = (0,_node_js__WEBPACK_IMPORTED_MODULE_1__/* .isNodeEnv */ .KV)() ? getNodePerformance() : getBrowserPerformance(); var timestampSource = platformPerformance === undefined ? dateTimestampSource : { nowSeconds: () => (platformPerformance.timeOrigin + platformPerformance.now()) / 1000, }; /** * Returns a timestamp in seconds since the UNIX epoch using the Date API. */ var dateTimestampInSeconds = dateTimestampSource.nowSeconds.bind(dateTimestampSource); /** * Returns a timestamp in seconds since the UNIX epoch using either the Performance or Date APIs, depending on the * availability of the Performance API. * * See `usingPerformanceAPI` to test whether the Performance API is used. * * BUG: Note that because of how browsers implement the Performance API, the clock might stop when the computer is * asleep. This creates a skew between `dateTimestampInSeconds` and `timestampInSeconds`. The * skew can grow to arbitrary amounts like days, weeks or months. * See https://github.com/getsentry/sentry-javascript/issues/2590. */ var timestampInSeconds = timestampSource.nowSeconds.bind(timestampSource); // Re-exported with an old name for backwards-compatibility. var timestampWithMs = timestampInSeconds; /** * A boolean that is true when timestampInSeconds uses the Performance API to produce monotonic timestamps. */ var usingPerformanceAPI = platformPerformance !== undefined; /** * Internal helper to store what is the source of browserPerformanceTimeOrigin below. For debugging only. */ let _browserPerformanceTimeOriginMode; /** * The number of milliseconds since the UNIX epoch. This value is only usable in a browser, and only when the * performance API is available. */ var browserPerformanceTimeOrigin = (() => { // Unfortunately browsers may report an inaccurate time origin data, through either performance.timeOrigin or // performance.timing.navigationStart, which results in poor results in performance data. We only treat time origin // data as reliable if they are within a reasonable threshold of the current time. const { performance } = (0,_global_js__WEBPACK_IMPORTED_MODULE_0__/* .getGlobalObject */ .R)(); if (!performance || !performance.now) { _browserPerformanceTimeOriginMode = 'none'; return undefined; } var threshold = 3600 * 1000; var performanceNow = performance.now(); var dateNow = Date.now(); // if timeOrigin isn't available set delta to threshold so it isn't used var timeOriginDelta = performance.timeOrigin ? Math.abs(performance.timeOrigin + performanceNow - dateNow) : threshold; var timeOriginIsReliable = timeOriginDelta < threshold; // While performance.timing.navigationStart is deprecated in favor of performance.timeOrigin, performance.timeOrigin // is not as widely supported. Namely, performance.timeOrigin is undefined in Safari as of writing. // Also as of writing, performance.timing is not available in Web Workers in mainstream browsers, so it is not always // a valid fallback. In the absence of an initial time provided by the browser, fallback to the current time from the // Date API. var navigationStart = performance.timing && performance.timing.navigationStart; var hasNavigationStart = typeof navigationStart === 'number'; // if navigationStart isn't available set delta to threshold so it isn't used var navigationStartDelta = hasNavigationStart ? Math.abs(navigationStart + performanceNow - dateNow) : threshold; var navigationStartIsReliable = navigationStartDelta < threshold; if (timeOriginIsReliable || navigationStartIsReliable) { // Use the more reliable time origin if (timeOriginDelta <= navigationStartDelta) { _browserPerformanceTimeOriginMode = 'timeOrigin'; return performance.timeOrigin; } else { _browserPerformanceTimeOriginMode = 'navigationStart'; return navigationStart; } } // Either both timeOrigin and navigationStart are skewed or neither is available, fallback to Date. _browserPerformanceTimeOriginMode = 'dateNow'; return dateNow; })(); //# sourceMappingURL=time.js.map /***/ }), /***/ 26956: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "en": function() { return /* binding */ parseUrl; }, /* harmony export */ "rt": function() { return /* binding */ stripUrlQueryAndFragment; } /* harmony export */ }); /* unused harmony export getNumberOfUrlSegments */ /** * Parses string form of URL into an object * // borrowed from https://tools.ietf.org/html/rfc3986#appendix-B * // intentionally using regex and not href parsing trick because React Native and other * // environments where DOM might not be available * @returns parsed URL object */ function parseUrl(url) { if (!url) { return {}; } var match = url.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/); if (!match) { return {}; } // coerce to undefined values to empty string so we don't get 'undefined' var query = match[6] || ''; var fragment = match[8] || ''; return { host: match[4], path: match[5], protocol: match[2], relative: match[5] + query + fragment, // everything minus origin }; } /** * Strip the query string and fragment off of a given URL or path (if present) * * @param urlPath Full URL or path, including possible query string and/or fragment * @returns URL or path without query string or fragment */ function stripUrlQueryAndFragment(urlPath) { return urlPath.split(/[\?#]/, 1)[0]; } /** * Returns number of URL segments of a passed string URL. */ function getNumberOfUrlSegments(url) { // split at '/' or at '\/' to split regex urls correctly return url.split(/\\?\//).filter(s => s.length > 0 && s !== ',').length; } //# sourceMappingURL=url.js.map /***/ }), /***/ 25436: /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { var _global = (typeof window !== 'undefined' ? window : typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof self !== 'undefined' ? self : {}); _global.SENTRY_RELEASE={id:"c9b5dd17437d8e65c393940ec00ccb6f185b6376"}; /***/ }), /***/ 79361: /***/ (function(__unused_webpack_module, exports) { "use strict"; var __webpack_unused_export__; __webpack_unused_export__ = ({ value: true }); exports.Z = _defineProperty; function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } /***/ }), /***/ 53783: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Q0": function() { return /* binding */ VersionUpgrade; }, /* harmony export */ "X0": function() { return /* binding */ getVersionUpgrade; } /* harmony export */ }); /* unused harmony exports diffTokenLists, isVersionUpdate, minVersionBump, nextVersion, schema, versionComparator */ var $schema = "http://json-schema.org/draft-07/schema#"; var $id = "https://uniswap.org/tokenlist.schema.json"; var title = "Uniswap Token List"; var description = "Schema for lists of tokens compatible with the Uniswap Interface"; var definitions = { Version: { type: "object", description: "The version of the list, used in change detection", examples: [ { major: 1, minor: 0, patch: 0 } ], additionalProperties: false, properties: { major: { type: "integer", description: "The major version of the list. Must be incremented when tokens are removed from the list or token addresses are changed.", minimum: 0, examples: [ 1, 2 ] }, minor: { type: "integer", description: "The minor version of the list. Must be incremented when tokens are added to the list.", minimum: 0, examples: [ 0, 1 ] }, patch: { type: "integer", description: "The patch version of the list. Must be incremented for any changes to the list.", minimum: 0, examples: [ 0, 1 ] } }, required: [ "major", "minor", "patch" ] }, TagIdentifier: { type: "string", description: "The unique identifier of a tag", minLength: 1, maxLength: 10, pattern: "^[\\w]+$", examples: [ "compound", "stablecoin" ] }, ExtensionIdentifier: { type: "string", description: "The name of a token extension property", minLength: 1, maxLength: 40, pattern: "^[\\w]+$", examples: [ "color", "is_fee_on_transfer", "aliases" ] }, ExtensionMap: { type: "object", description: "An object containing any arbitrary or vendor-specific token metadata", maxProperties: 10, propertyNames: { $ref: "#/definitions/ExtensionIdentifier" }, additionalProperties: { $ref: "#/definitions/ExtensionValue" }, examples: [ { color: "#000000", is_verified_by_me: true }, { "x-bridged-addresses-by-chain": { "1": { bridgeAddress: "0x4200000000000000000000000000000000000010", tokenAddress: "0x4200000000000000000000000000000000000010" } } } ] }, ExtensionPrimitiveValue: { anyOf: [ { type: "string", minLength: 1, maxLength: 42, examples: [ "#00000" ] }, { type: "boolean", examples: [ true ] }, { type: "number", examples: [ 15 ] }, { type: "null" } ] }, ExtensionValue: { anyOf: [ { $ref: "#/definitions/ExtensionPrimitiveValue" }, { type: "object", maxProperties: 10, propertyNames: { $ref: "#/definitions/ExtensionIdentifier" }, additionalProperties: { $ref: "#/definitions/ExtensionValueInner0" } } ] }, ExtensionValueInner0: { anyOf: [ { $ref: "#/definitions/ExtensionPrimitiveValue" }, { type: "object", maxProperties: 10, propertyNames: { $ref: "#/definitions/ExtensionIdentifier" }, additionalProperties: { $ref: "#/definitions/ExtensionValueInner1" } } ] }, ExtensionValueInner1: { anyOf: [ { $ref: "#/definitions/ExtensionPrimitiveValue" } ] }, TagDefinition: { type: "object", description: "Definition of a tag that can be associated with a token via its identifier", additionalProperties: false, properties: { name: { type: "string", description: "The name of the tag", pattern: "^[ \\w]+$", minLength: 1, maxLength: 20 }, description: { type: "string", description: "A user-friendly description of the tag", pattern: "^[ \\w\\.,:]+$", minLength: 1, maxLength: 200 } }, required: [ "name", "description" ], examples: [ { name: "Stablecoin", description: "A token with value pegged to another asset" } ] }, TokenInfo: { type: "object", description: "Metadata for a single token in a token list", additionalProperties: false, properties: { chainId: { type: "integer", description: "The chain ID of the Ethereum network where this token is deployed", minimum: 1, examples: [ 1, 42 ] }, address: { type: "string", description: "The checksummed address of the token on the specified chain ID", pattern: "^0x[a-fA-F0-9]{40}$", examples: [ "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" ] }, decimals: { type: "integer", description: "The number of decimals for the token balance", minimum: 0, maximum: 255, examples: [ 18 ] }, name: { type: "string", description: "The name of the token", minLength: 1, maxLength: 40, pattern: "^[ \\w.'+\\-%/À-ÖØ-öø-ÿ:&\\[\\]\\(\\)]+$", examples: [ "USD Coin" ] }, symbol: { type: "string", description: "The symbol for the token; must be alphanumeric", pattern: "^[a-zA-Z0-9+\\-%/$.]+$", minLength: 1, maxLength: 20, examples: [ "USDC" ] }, logoURI: { type: "string", description: "A URI to the token logo asset; if not set, interface will attempt to find a logo based on the token address; suggest SVG or PNG of size 64x64", format: "uri", examples: [ "ipfs://QmXfzKRvjZz3u5JRgC4v5mGVbm9ahrUiB4DgzHBsnWbTMM" ] }, tags: { type: "array", description: "An array of tag identifiers associated with the token; tags are defined at the list level", items: { $ref: "#/definitions/TagIdentifier" }, maxItems: 10, examples: [ "stablecoin", "compound" ] }, extensions: { $ref: "#/definitions/ExtensionMap" } }, required: [ "chainId", "address", "decimals", "name", "symbol" ] } }; var type = "object"; var additionalProperties = false; var properties = { name: { type: "string", description: "The name of the token list", minLength: 1, maxLength: 20, pattern: "^[\\w ]+$", examples: [ "My Token List" ] }, timestamp: { type: "string", format: "date-time", description: "The timestamp of this list version; i.e. when this immutable version of the list was created" }, version: { $ref: "#/definitions/Version" }, tokens: { type: "array", description: "The list of tokens included in the list", items: { $ref: "#/definitions/TokenInfo" }, minItems: 1, maxItems: 10000 }, keywords: { type: "array", description: "Keywords associated with the contents of the list; may be used in list discoverability", items: { type: "string", description: "A keyword to describe the contents of the list", minLength: 1, maxLength: 20, pattern: "^[\\w ]+$", examples: [ "compound", "lending", "personal tokens" ] }, maxItems: 20, uniqueItems: true }, tags: { type: "object", description: "A mapping of tag identifiers to their name and description", propertyNames: { $ref: "#/definitions/TagIdentifier" }, additionalProperties: { $ref: "#/definitions/TagDefinition" }, maxProperties: 20, examples: [ { stablecoin: { name: "Stablecoin", description: "A token with value pegged to another asset" } } ] }, logoURI: { type: "string", description: "A URI for the logo of the token list; prefer SVG or PNG of size 256x256", format: "uri", examples: [ "ipfs://QmXfzKRvjZz3u5JRgC4v5mGVbm9ahrUiB4DgzHBsnWbTMM" ] } }; var required = [ "name", "timestamp", "version", "tokens" ]; var tokenlist_schema = { $schema: $schema, $id: $id, title: title, description: description, definitions: definitions, type: type, additionalProperties: additionalProperties, properties: properties, required: required }; /** * Comparator function that allows sorting version from lowest to highest * @param versionA version A to compare * @param versionB version B to compare * @returns -1 if versionA comes before versionB, 0 if versionA is equal to version B, and 1 if version A comes after version B */ function versionComparator(versionA, versionB) { if (versionA.major < versionB.major) { return -1; } else if (versionA.major > versionB.major) { return 1; } else if (versionA.minor < versionB.minor) { return -1; } else if (versionA.minor > versionB.minor) { return 1; } else if (versionA.patch < versionB.patch) { return -1; } else if (versionA.patch > versionB.patch) { return 1; } else { return 0; } } /** * Returns true if versionB is an update over versionA */ function isVersionUpdate(base, update) { return versionComparator(base, update) < 0; } var VersionUpgrade; (function (VersionUpgrade) { VersionUpgrade[VersionUpgrade["NONE"] = 0] = "NONE"; VersionUpgrade[VersionUpgrade["PATCH"] = 1] = "PATCH"; VersionUpgrade[VersionUpgrade["MINOR"] = 2] = "MINOR"; VersionUpgrade[VersionUpgrade["MAJOR"] = 3] = "MAJOR"; })(VersionUpgrade || (VersionUpgrade = {})); /** * Return the upgrade type from the base version to the update version. * Note that downgrades and equivalent versions are both treated as `NONE`. * @param base base list * @param update update to the list */ function getVersionUpgrade(base, update) { if (update.major > base.major) { return VersionUpgrade.MAJOR; } if (update.major < base.major) { return VersionUpgrade.NONE; } if (update.minor > base.minor) { return VersionUpgrade.MINOR; } if (update.minor < base.minor) { return VersionUpgrade.NONE; } return update.patch > base.patch ? VersionUpgrade.PATCH : VersionUpgrade.NONE; } /** * compares two token info key values * this subset of full deep equal functionality does not work on objects or object arrays * @param a comparison item a * @param b comparison item b */ function compareTokenInfoProperty(a, b) { if (a === b) return true; if (typeof a !== typeof b) return false; if (Array.isArray(a) && Array.isArray(b)) { return a.every(function (el, i) { return b[i] === el; }); } return false; } /** * Computes the diff of a token list where the first argument is the base and the second argument is the updated list. * @param base base list * @param update updated list */ function diffTokenLists(base, update) { var indexedBase = base.reduce(function (memo, tokenInfo) { if (!memo[tokenInfo.chainId]) memo[tokenInfo.chainId] = {}; memo[tokenInfo.chainId][tokenInfo.address] = tokenInfo; return memo; }, {}); var newListUpdates = update.reduce(function (memo, tokenInfo) { var _indexedBase$tokenInf; var baseToken = (_indexedBase$tokenInf = indexedBase[tokenInfo.chainId]) == null ? void 0 : _indexedBase$tokenInf[tokenInfo.address]; if (!baseToken) { memo.added.push(tokenInfo); } else { var changes = Object.keys(tokenInfo).filter(function (s) { return s !== 'address' && s !== 'chainId'; }).filter(function (s) { return !compareTokenInfoProperty(tokenInfo[s], baseToken[s]); }); if (changes.length > 0) { if (!memo.changed[tokenInfo.chainId]) { memo.changed[tokenInfo.chainId] = {}; } memo.changed[tokenInfo.chainId][tokenInfo.address] = changes; } } if (!memo.index[tokenInfo.chainId]) { var _memo$index$tokenInfo; memo.index[tokenInfo.chainId] = (_memo$index$tokenInfo = {}, _memo$index$tokenInfo[tokenInfo.address] = true, _memo$index$tokenInfo); } else { memo.index[tokenInfo.chainId][tokenInfo.address] = true; } return memo; }, { added: [], changed: {}, index: {} }); var removed = base.reduce(function (list, curr) { if (!newListUpdates.index[curr.chainId] || !newListUpdates.index[curr.chainId][curr.address]) { list.push(curr); } return list; }, []); return { added: newListUpdates.added, changed: newListUpdates.changed, removed: removed }; } /** * Returns the minimum version bump for the given list * @param baseList the base list of tokens * @param updatedList the updated list of tokens */ function minVersionBump(baseList, updatedList) { var diff = diffTokenLists(baseList, updatedList); if (diff.removed.length > 0) return VersionUpgrade.MAJOR; if (diff.added.length > 0) return VersionUpgrade.MINOR; if (Object.keys(diff.changed).length > 0) return VersionUpgrade.PATCH; return VersionUpgrade.NONE; } /** * Returns the next version of the list given a base version and the upgrade type * @param base current version * @param bump the upgrade type */ function nextVersion(base, bump) { switch (bump) { case VersionUpgrade.NONE: return base; case VersionUpgrade.MAJOR: return { major: base.major + 1, minor: 0, patch: 0 }; case VersionUpgrade.MINOR: return { major: base.major, minor: base.minor + 1, patch: 0 }; case VersionUpgrade.PATCH: return { major: base.major, minor: base.minor, patch: base.patch + 1 }; } } //# sourceMappingURL=token-lists.esm.js.map /***/ }), /***/ 41727: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "g": function() { return /* binding */ vars; } /* harmony export */ }); /* harmony import */ var packages_ui_css_vars_css_ts_vanilla_css_node_modules_vanilla_extract_webpack_plugin_virtualFileLoader_dist_vanilla_extract_webpack_plugin_virtualFileLoader_cjs_js_fileName_packages_ui_css_vars_css_ts_vanilla_css_source_H4sIAAAAAAAAA_1YXY_bRhR9z69AiaIkEl7NF1_u_mCMaauqTyu1D1UfxoC9KCxYgJM0Vf97ZwaMAV8GkuyqD60dx96Zw5k7d4Y53LMui6I2_nphGKtVVGRFWa2y9PhQrz4_pHWyNtTXd7fdB55m51IAXu0C5nu7aQilHYhSAHYq00de_ilAB4djxKYh6NCB0GEaRoMORoNpmF_KvwQ0OfBIF1nAy_cCFhNuYQzAqnMUJVUlIBQHaLOZhmCvA2EPgH3kZZ7mRwEKQ59QZxpCgi6pBJpjC5vL_T7NeR7JVQyR7yEfgBQfkjLjcnmYRbjDAcixyGIV89ZBCJp9mgkSgfCJfENxlEX_WW0mx3MYNKEqiYo8bvaJRRx0gPLXgVzUwVwooj2P3h_L4pyruDehF0KrdkUFacX3WSLRO2_32UGJuqI3Wa3SIV9zQLI2yuOevyWWZRrX_9Cd8w64NOJl7BdlrLK5c3YUjEQkoS55JYPAHqbEBjBxWZzi4mMuA7XlW4MJkuQkx1MvAJfmYnnrJN5ex52cfJqfzuqmSxJ_gO51BbjvrXbsRDyJAGQtBk0bzC4MWWiBmE9yNOKiwILCkf2e1yE8aFdJTG8D_MGWbKHIJe7_vK8zuZFd5nIP2urxgq10LHmcJnntn_cCejw_ro0szRNedj1vMfXuHBonR1PwWGEQhgZ6LX6HVOQiNDBCr6ENdLn_J7lkVbJwgJZUDdAONjfAVuzUHxOuduoNNcZ3tttSk902JC21G5LQnqX2s3MCkLqoYdw4ggc3jB7bYcE_x_hrWmRJreHcka0X_g3nNvDdcLOQUx0Fk7RbP3B2bV69jRcGaJb2B3XWTjKGYeAi1G6FYONTaPLixno_re_qVyvvfcS0wiiUVtz7iGlt76Ompb2P0il7H9cKO0Keu8G3KK2u9xHTst5kWqfqfcS0qPdRMxnXSrpCaBVdIaYFvZm2Rs_bGDRy3jDo1XyImRbzZrC_liMX2dCcQSmnEXUYFP5IyRHHDgGWDRRy6pkGdU2DMUDF1WUDEcc2IRTYfJFWSxWkJ_F4hwMC5Gak4OIo2GL3FgYIOIIW_iLeSL0cICU36k1sgilA1RNvalGLAVytdodYvuFuJd2N1HrAFhop93TYc9LdJPPKZBHm28DNBwg3nMmv02EakI3FmtOdYhpY26nTHZLhV5jghMSaqPXCKlKHnFatsOc47uzos7pqb5nneQ2lHbDAn5SrL5FVRpnlWC2rbTluMMf6Tap6EHdNtcqL8pFna_PNzzxP6zemUfG8EodYmR76sMciL9bGffiL_DaNc6oaqhOPEtPofjYXqJ8rcfih06d_C14bbNgizh532CI0AtvDJrY2yOg6a21QMmyyBfmIy1kb9ujC0yfBP6KXbSOYK9tGbJioi0fDymBvQyaKdBw1VQzjwJkabBy7rRiu4e_VuftbGtcP1SC1gw7cm92gQyS6G1buknTA0bRUYhtkvVQ0rbF4FjnLXXudY9Mh1aA_x7Y1LSN5GFno9XX33KefExEcUqnqRu31jFLb6xmlt9ejEoTZbQ9R4xBgHKZ62HVbPnAhMuJJNfmQZFglRKZJRWLITXApcU0Dt_qI7vA7UwFx_wEgyHo3HIBHdfohaQa4fOS17SOc2TWK6RjduBRLUsFKMJG0bMTaPefd0DbPdOagg11omWREIlDsIElLRrTdY98NbfPwNkErHhBNw5F5sFyI9lBEZyjW0NmIp2KQ9C1hjoltbDKIMM0reUarr27p1Mp1y_KIC_WnGUAs3ZChLoqsTk_XoMjlQpmY5p8Y1uxiGm0MLKnZ5ZFJsv_94veY13xVPySPyfcvVQn08o_hTTlZwGhrl9myRVuxzBYrs3XKghJl1nbUFiazNYm2HJmtRGaLEG39oS09pqsOXcGhqzVmyowFFcacUbjUIlxgDn6VLThnCOqtQL0JOG_LTP_NJbfErNPb_NNG3x6a2_e1JutCbQL_hwW3jOad89i2z2lYfe0Vt2Tm3TfXEiMFE9WJ_9RwQPsuP8F798RPMBNW2qkLfDQvtw_m3POZkwzvV82a5UtcMm0BtkSb0xvi007YnozbIkP9gVyB7hfS4yvZ_S8ltpdT_l0Pa3J9eT_1rcr0j9sZsq_GyIAAA_node_modules_vanilla_extract_webpack_plugin_extracted_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15666); /* harmony import */ var packages_ui_css_vars_css_ts_vanilla_css_node_modules_vanilla_extract_webpack_plugin_virtualFileLoader_dist_vanilla_extract_webpack_plugin_virtualFileLoader_cjs_js_fileName_packages_ui_css_vars_css_ts_vanilla_css_source_H4sIAAAAAAAAA_1YXY_bRhR9z69AiaIkEl7NF1_u_mCMaauqTyu1D1UfxoC9KCxYgJM0Vf97ZwaMAV8GkuyqD60dx96Zw5k7d4Y53LMui6I2_nphGKtVVGRFWa2y9PhQrz4_pHWyNtTXd7fdB55m51IAXu0C5nu7aQilHYhSAHYq00de_ilAB4djxKYh6NCB0GEaRoMORoNpmF_KvwQ0OfBIF1nAy_cCFhNuYQzAqnMUJVUlIBQHaLOZhmCvA2EPgH3kZZ7mRwEKQ59QZxpCgi6pBJpjC5vL_T7NeR7JVQyR7yEfgBQfkjLjcnmYRbjDAcixyGIV89ZBCJp9mgkSgfCJfENxlEX_WW0mx3MYNKEqiYo8bvaJRRx0gPLXgVzUwVwooj2P3h_L4pyruDehF0KrdkUFacX3WSLRO2_32UGJuqI3Wa3SIV9zQLI2yuOevyWWZRrX_9Cd8w64NOJl7BdlrLK5c3YUjEQkoS55JYPAHqbEBjBxWZzi4mMuA7XlW4MJkuQkx1MvAJfmYnnrJN5ex52cfJqfzuqmSxJ_gO51BbjvrXbsRDyJAGQtBk0bzC4MWWiBmE9yNOKiwILCkf2e1yE8aFdJTG8D_MGWbKHIJe7_vK8zuZFd5nIP2urxgq10LHmcJnntn_cCejw_ro0szRNedj1vMfXuHBonR1PwWGEQhgZ6LX6HVOQiNDBCr6ENdLn_J7lkVbJwgJZUDdAONjfAVuzUHxOuduoNNcZ3tttSk902JC21G5LQnqX2s3MCkLqoYdw4ggc3jB7bYcE_x_hrWmRJreHcka0X_g3nNvDdcLOQUx0Fk7RbP3B2bV69jRcGaJb2B3XWTjKGYeAi1G6FYONTaPLixno_re_qVyvvfcS0wiiUVtz7iGlt76Ompb2P0il7H9cKO0Keu8G3KK2u9xHTst5kWqfqfcS0qPdRMxnXSrpCaBVdIaYFvZm2Rs_bGDRy3jDo1XyImRbzZrC_liMX2dCcQSmnEXUYFP5IyRHHDgGWDRRy6pkGdU2DMUDF1WUDEcc2IRTYfJFWSxWkJ_F4hwMC5Gak4OIo2GL3FgYIOIIW_iLeSL0cICU36k1sgilA1RNvalGLAVytdodYvuFuJd2N1HrAFhop93TYc9LdJPPKZBHm28DNBwg3nMmv02EakI3FmtOdYhpY26nTHZLhV5jghMSaqPXCKlKHnFatsOc47uzos7pqb5nneQ2lHbDAn5SrL5FVRpnlWC2rbTluMMf6Tap6EHdNtcqL8pFna_PNzzxP6zemUfG8EodYmR76sMciL9bGffiL_DaNc6oaqhOPEtPofjYXqJ8rcfih06d_C14bbNgizh532CI0AtvDJrY2yOg6a21QMmyyBfmIy1kb9ujC0yfBP6KXbSOYK9tGbJioi0fDymBvQyaKdBw1VQzjwJkabBy7rRiu4e_VuftbGtcP1SC1gw7cm92gQyS6G1buknTA0bRUYhtkvVQ0rbF4FjnLXXudY9Mh1aA_x7Y1LSN5GFno9XX33KefExEcUqnqRu31jFLb6xmlt9ejEoTZbQ9R4xBgHKZ62HVbPnAhMuJJNfmQZFglRKZJRWLITXApcU0Dt_qI7vA7UwFx_wEgyHo3HIBHdfohaQa4fOS17SOc2TWK6RjduBRLUsFKMJG0bMTaPefd0DbPdOagg11omWREIlDsIElLRrTdY98NbfPwNkErHhBNw5F5sFyI9lBEZyjW0NmIp2KQ9C1hjoltbDKIMM0reUarr27p1Mp1y_KIC_WnGUAs3ZChLoqsTk_XoMjlQpmY5p8Y1uxiGm0MLKnZ5ZFJsv_94veY13xVPySPyfcvVQn08o_hTTlZwGhrl9myRVuxzBYrs3XKghJl1nbUFiazNYm2HJmtRGaLEG39oS09pqsOXcGhqzVmyowFFcacUbjUIlxgDn6VLThnCOqtQL0JOG_LTP_NJbfErNPb_NNG3x6a2_e1JutCbQL_hwW3jOad89i2z2lYfe0Vt2Tm3TfXEiMFE9WJ_9RwQPsuP8F798RPMBNW2qkLfDQvtw_m3POZkwzvV82a5UtcMm0BtkSb0xvi007YnozbIkP9gVyB7hfS4yvZ_S8ltpdT_l0Pa3J9eT_1rcr0j9sZsq_GyIAAA_node_modules_vanilla_extract_webpack_plugin_extracted_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(packages_ui_css_vars_css_ts_vanilla_css_node_modules_vanilla_extract_webpack_plugin_virtualFileLoader_dist_vanilla_extract_webpack_plugin_virtualFileLoader_cjs_js_fileName_packages_ui_css_vars_css_ts_vanilla_css_source_H4sIAAAAAAAAA_1YXY_bRhR9z69AiaIkEl7NF1_u_mCMaauqTyu1D1UfxoC9KCxYgJM0Vf97ZwaMAV8GkuyqD60dx96Zw5k7d4Y53LMui6I2_nphGKtVVGRFWa2y9PhQrz4_pHWyNtTXd7fdB55m51IAXu0C5nu7aQilHYhSAHYq00de_ilAB4djxKYh6NCB0GEaRoMORoNpmF_KvwQ0OfBIF1nAy_cCFhNuYQzAqnMUJVUlIBQHaLOZhmCvA2EPgH3kZZ7mRwEKQ59QZxpCgi6pBJpjC5vL_T7NeR7JVQyR7yEfgBQfkjLjcnmYRbjDAcixyGIV89ZBCJp9mgkSgfCJfENxlEX_WW0mx3MYNKEqiYo8bvaJRRx0gPLXgVzUwVwooj2P3h_L4pyruDehF0KrdkUFacX3WSLRO2_32UGJuqI3Wa3SIV9zQLI2yuOevyWWZRrX_9Cd8w64NOJl7BdlrLK5c3YUjEQkoS55JYPAHqbEBjBxWZzi4mMuA7XlW4MJkuQkx1MvAJfmYnnrJN5ex52cfJqfzuqmSxJ_gO51BbjvrXbsRDyJAGQtBk0bzC4MWWiBmE9yNOKiwILCkf2e1yE8aFdJTG8D_MGWbKHIJe7_vK8zuZFd5nIP2urxgq10LHmcJnntn_cCejw_ro0szRNedj1vMfXuHBonR1PwWGEQhgZ6LX6HVOQiNDBCr6ENdLn_J7lkVbJwgJZUDdAONjfAVuzUHxOuduoNNcZ3tttSk902JC21G5LQnqX2s3MCkLqoYdw4ggc3jB7bYcE_x_hrWmRJreHcka0X_g3nNvDdcLOQUx0Fk7RbP3B2bV69jRcGaJb2B3XWTjKGYeAi1G6FYONTaPLixno_re_qVyvvfcS0wiiUVtz7iGlt76Ompb2P0il7H9cKO0Keu8G3KK2u9xHTst5kWqfqfcS0qPdRMxnXSrpCaBVdIaYFvZm2Rs_bGDRy3jDo1XyImRbzZrC_liMX2dCcQSmnEXUYFP5IyRHHDgGWDRRy6pkGdU2DMUDF1WUDEcc2IRTYfJFWSxWkJ_F4hwMC5Gak4OIo2GL3FgYIOIIW_iLeSL0cICU36k1sgilA1RNvalGLAVytdodYvuFuJd2N1HrAFhop93TYc9LdJPPKZBHm28DNBwg3nMmv02EakI3FmtOdYhpY26nTHZLhV5jghMSaqPXCKlKHnFatsOc47uzos7pqb5nneQ2lHbDAn5SrL5FVRpnlWC2rbTluMMf6Tap6EHdNtcqL8pFna_PNzzxP6zemUfG8EodYmR76sMciL9bGffiL_DaNc6oaqhOPEtPofjYXqJ8rcfih06d_C14bbNgizh532CI0AtvDJrY2yOg6a21QMmyyBfmIy1kb9ujC0yfBP6KXbSOYK9tGbJioi0fDymBvQyaKdBw1VQzjwJkabBy7rRiu4e_VuftbGtcP1SC1gw7cm92gQyS6G1buknTA0bRUYhtkvVQ0rbF4FjnLXXudY9Mh1aA_x7Y1LSN5GFno9XX33KefExEcUqnqRu31jFLb6xmlt9ejEoTZbQ9R4xBgHKZ62HVbPnAhMuJJNfmQZFglRKZJRWLITXApcU0Dt_qI7vA7UwFx_wEgyHo3HIBHdfohaQa4fOS17SOc2TWK6RjduBRLUsFKMJG0bMTaPefd0DbPdOagg11omWREIlDsIElLRrTdY98NbfPwNkErHhBNw5F5sFyI9lBEZyjW0NmIp2KQ9C1hjoltbDKIMM0reUarr27p1Mp1y_KIC_WnGUAs3ZChLoqsTk_XoMjlQpmY5p8Y1uxiGm0MLKnZ5ZFJsv_94veY13xVPySPyfcvVQn08o_hTTlZwGhrl9myRVuxzBYrs3XKghJl1nbUFiazNYm2HJmtRGaLEG39oS09pqsOXcGhqzVmyowFFcacUbjUIlxgDn6VLThnCOqtQL0JOG_LTP_NJbfErNPb_NNG3x6a2_e1JutCbQL_hwW3jOad89i2z2lYfe0Vt2Tm3TfXEiMFE9WJ_9RwQPsuP8F798RPMBNW2qkLfDQvtw_m3POZkwzvV82a5UtcMm0BtkSb0xvi007YnozbIkP9gVyB7hfS4yvZ_S8ltpdT_l0Pa3J9eT_1rcr0j9sZsq_GyIAAA_node_modules_vanilla_extract_webpack_plugin_extracted_js__WEBPACK_IMPORTED_MODULE_0__); var vars = {colors:{light:{white:'var(--colors-light-white)',failure:'var(--colors-light-failure)',failure33:'var(--colors-light-failure33)',primary:'var(--colors-light-primary)',primary0f:'var(--colors-light-primary0f)',primary3D:'var(--colors-light-primary3D)',primaryBright:'var(--colors-light-primaryBright)',primaryDark:'var(--colors-light-primaryDark)',success:'var(--colors-light-success)',success19:'var(--colors-light-success19)',warning:'var(--colors-light-warning)',warning2D:'var(--colors-light-warning2D)',warning33:'var(--colors-light-warning33)',binance:'var(--colors-light-binance)',overlay:'var(--colors-light-overlay)',gold:'var(--colors-light-gold)',silver:'var(--colors-light-silver)',bronze:'var(--colors-light-bronze)',secondary:'var(--colors-light-secondary)',secondary80:'var(--colors-light-secondary80)',background:'var(--colors-light-background)',backgroundDisabled:'var(--colors-light-backgroundDisabled)',backgroundAlt:'var(--colors-light-backgroundAlt)',backgroundAlt2:'var(--colors-light-backgroundAlt2)',cardBorder:'var(--colors-light-cardBorder)',contrast:'var(--colors-light-contrast)',dropdown:'var(--colors-light-dropdown)',dropdownDeep:'var(--colors-light-dropdownDeep)',invertedContrast:'var(--colors-light-invertedContrast)',input:'var(--colors-light-input)',inputSecondary:'var(--colors-light-inputSecondary)',tertiary:'var(--colors-light-tertiary)',text:'var(--colors-light-text)',text99:'var(--colors-light-text99)',textDisabled:'var(--colors-light-textDisabled)',textSubtle:'var(--colors-light-textSubtle)',disabled:'var(--colors-light-disabled)',gradientBubblegum:'var(--colors-light-gradientBubblegum)',gradientInverseBubblegum:'var(--colors-light-gradientInverseBubblegum)',gradientCardHeader:'var(--colors-light-gradientCardHeader)',gradientBlue:'var(--colors-light-gradientBlue)',gradientViolet:'var(--colors-light-gradientViolet)',gradientVioletAlt:'var(--colors-light-gradientVioletAlt)',gradientGold:'var(--colors-light-gradientGold)'},dark:{white:'var(--colors-dark-white)',failure:'var(--colors-dark-failure)',failure33:'var(--colors-dark-failure33)',primary:'var(--colors-dark-primary)',primary0f:'var(--colors-dark-primary0f)',primary3D:'var(--colors-dark-primary3D)',primaryBright:'var(--colors-dark-primaryBright)',primaryDark:'var(--colors-dark-primaryDark)',success:'var(--colors-dark-success)',success19:'var(--colors-dark-success19)',warning:'var(--colors-dark-warning)',warning2D:'var(--colors-dark-warning2D)',warning33:'var(--colors-dark-warning33)',binance:'var(--colors-dark-binance)',overlay:'var(--colors-dark-overlay)',gold:'var(--colors-dark-gold)',silver:'var(--colors-dark-silver)',bronze:'var(--colors-dark-bronze)',secondary:'var(--colors-dark-secondary)',secondary80:'var(--colors-dark-secondary80)',background:'var(--colors-dark-background)',backgroundDisabled:'var(--colors-dark-backgroundDisabled)',backgroundAlt:'var(--colors-dark-backgroundAlt)',backgroundAlt2:'var(--colors-dark-backgroundAlt2)',cardBorder:'var(--colors-dark-cardBorder)',contrast:'var(--colors-dark-contrast)',dropdown:'var(--colors-dark-dropdown)',dropdownDeep:'var(--colors-dark-dropdownDeep)',invertedContrast:'var(--colors-dark-invertedContrast)',input:'var(--colors-dark-input)',inputSecondary:'var(--colors-dark-inputSecondary)',tertiary:'var(--colors-dark-tertiary)',text:'var(--colors-dark-text)',text99:'var(--colors-dark-text99)',textDisabled:'var(--colors-dark-textDisabled)',textSubtle:'var(--colors-dark-textSubtle)',disabled:'var(--colors-dark-disabled)',gradientBubblegum:'var(--colors-dark-gradientBubblegum)',gradientInverseBubblegum:'var(--colors-dark-gradientInverseBubblegum)',gradientCardHeader:'var(--colors-dark-gradientCardHeader)',gradientBlue:'var(--colors-dark-gradientBlue)',gradientViolet:'var(--colors-dark-gradientViolet)',gradientVioletAlt:'var(--colors-dark-gradientVioletAlt)',gradientGold:'var(--colors-dark-gradientGold)'},white:'var(--colors-white)',failure:'var(--colors-failure)',failure33:'var(--colors-failure33)',primary:'var(--colors-primary)',primary0f:'var(--colors-primary0f)',primary3D:'var(--colors-primary3D)',primaryBright:'var(--colors-primaryBright)',primaryDark:'var(--colors-primaryDark)',success:'var(--colors-success)',success19:'var(--colors-success19)',warning:'var(--colors-warning)',warning2D:'var(--colors-warning2D)',warning33:'var(--colors-warning33)',binance:'var(--colors-binance)',overlay:'var(--colors-overlay)',gold:'var(--colors-gold)',silver:'var(--colors-silver)',bronze:'var(--colors-bronze)',secondary:'var(--colors-secondary)',secondary80:'var(--colors-secondary80)',background:'var(--colors-background)',backgroundDisabled:'var(--colors-backgroundDisabled)',backgroundAlt:'var(--colors-backgroundAlt)',backgroundAlt2:'var(--colors-backgroundAlt2)',cardBorder:'var(--colors-cardBorder)',contrast:'var(--colors-contrast)',dropdown:'var(--colors-dropdown)',dropdownDeep:'var(--colors-dropdownDeep)',invertedContrast:'var(--colors-invertedContrast)',input:'var(--colors-input)',inputSecondary:'var(--colors-inputSecondary)',tertiary:'var(--colors-tertiary)',text:'var(--colors-text)',text99:'var(--colors-text99)',textDisabled:'var(--colors-textDisabled)',textSubtle:'var(--colors-textSubtle)',disabled:'var(--colors-disabled)',gradientBubblegum:'var(--colors-gradientBubblegum)',gradientInverseBubblegum:'var(--colors-gradientInverseBubblegum)',gradientCardHeader:'var(--colors-gradientCardHeader)',gradientBlue:'var(--colors-gradientBlue)',gradientViolet:'var(--colors-gradientViolet)',gradientVioletAlt:'var(--colors-gradientVioletAlt)',gradientGold:'var(--colors-gradientGold)'},fonts:{normal:'var(--fonts-normal)',mono:'var(--fonts-mono)'},space:{'0':'var(--space-0)','1':'var(--space-1)','2':'var(--space-2)','3':'var(--space-3)','4':'var(--space-4)','5':'var(--space-5)','6':'var(--space-6)','7':'var(--space-7)',px:'var(--space-px)','4px':'var(--space-4px)','8px':'var(--space-8px)','12px':'var(--space-12px)','16px':'var(--space-16px)','24px':'var(--space-24px)','32px':'var(--space-32px)','48px':'var(--space-48px)','64px':'var(--space-64px)'},borderWidths:{'0':'var(--borderWidths-0)','1':'var(--borderWidths-1)','2':'var(--borderWidths-2)'},radii:{'0':'var(--radii-0)',small:'var(--radii-small)','default':'var(--radii-default)',card:'var(--radii-card)',circle:'var(--radii-circle)'},fontSizes:{'10px':'var(--fontSizes-10px)','12px':'var(--fontSizes-12px)','16px':'var(--fontSizes-16px)','14px':'var(--fontSizes-14px)','20px':'var(--fontSizes-20px)','40px':'var(--fontSizes-40px)'},shadows:{level1:'var(--shadows-level1)',active:'var(--shadows-active)',success:'var(--shadows-success)',warning:'var(--shadows-warning)',focus:'var(--shadows-focus)',inset:'var(--shadows-inset)',tooltip:'var(--shadows-tooltip)'}}; /***/ }), /***/ 98392: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "a": function() { return /* binding */ allChains; }, /* harmony export */ "b": function() { return /* binding */ chainId; }, /* harmony export */ "c": function() { return /* binding */ chain; }, /* harmony export */ "d": function() { return /* binding */ defaultChains; }, /* harmony export */ "e": function() { return /* binding */ defaultL2Chains; }, /* harmony export */ "f": function() { return /* binding */ etherscanBlockExplorers; }, /* harmony export */ "k": function() { return /* binding */ goerli; }, /* harmony export */ "u": function() { return /* binding */ rinkeby; } /* harmony export */ }); /* unused harmony exports g, h, i, j, l, m, n, o, p, q, r, s, t, v */ /* harmony import */ var _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(87782); const etherscanBlockExplorers = { mainnet: { name: 'Etherscan', url: 'https://etherscan.io' }, ropsten: { name: 'Etherscan', url: 'https://ropsten.etherscan.io' }, rinkeby: { name: 'Etherscan', url: 'https://rinkeby.etherscan.io' }, goerli: { name: 'Etherscan', url: 'https://goerli.etherscan.io' }, kovan: { name: 'Etherscan', url: 'https://kovan.etherscan.io' }, optimism: { name: 'Etherscan', url: 'https://optimistic.etherscan.io' }, optimismKovan: { name: 'Etherscan', url: 'https://kovan-optimistic.etherscan.io' }, polygon: { name: 'PolygonScan', url: 'https://polygonscan.com' }, polygonMumbai: { name: 'PolygonScan', url: 'https://mumbai.polygonscan.com' }, arbitrum: { name: 'Arbiscan', url: 'https://arbiscan.io' }, arbitrumRinkeby: { name: 'Arbiscan', url: 'https://testnet.arbiscan.io' } }; const chainId = { mainnet: 1, ropsten: 3, rinkeby: 4, goerli: 5, kovan: 42, optimism: 10, optimismKovan: 69, optimismGoerli: 420, polygon: 137, polygonMumbai: 80001, arbitrum: 42161, arbitrumRinkeby: 421611, arbitrumGoerli: 421613, localhost: 1337, hardhat: 31337, foundry: 31337 }; const mainnet = { id: chainId.mainnet, name: 'Ethereum', network: 'homestead', nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, rpcUrls: { alchemy: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.a.mainnet, default: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.p.mainnet, infura: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.i.mainnet, public: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.p.mainnet }, blockExplorers: { etherscan: etherscanBlockExplorers.mainnet, default: etherscanBlockExplorers.mainnet }, ens: { address: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e' }, multicall: { address: '0xca11bde05977b3631167028862be2a173976ca11', blockCreated: 14353601 } }; const ropsten = { id: chainId.ropsten, name: 'Ropsten', network: 'ropsten', nativeCurrency: { name: 'Ropsten Ether', symbol: 'ETH', decimals: 18 }, rpcUrls: { alchemy: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.a.ropsten, default: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.p.ropsten, infura: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.i.ropsten, public: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.p.ropsten }, blockExplorers: { etherscan: etherscanBlockExplorers.ropsten, default: etherscanBlockExplorers.ropsten }, ens: { address: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e' }, multicall: { address: '0xca11bde05977b3631167028862be2a173976ca11', blockCreated: 12063863 }, testnet: true }; const rinkeby = { id: chainId.rinkeby, name: 'Rinkeby', network: 'rinkeby', nativeCurrency: { name: 'Rinkeby Ether', symbol: 'ETH', decimals: 18 }, rpcUrls: { alchemy: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.a.rinkeby, default: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.p.rinkeby, infura: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.i.rinkeby, public: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.p.rinkeby }, blockExplorers: { etherscan: etherscanBlockExplorers.rinkeby, default: etherscanBlockExplorers.rinkeby }, ens: { address: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e' }, multicall: { address: '0xca11bde05977b3631167028862be2a173976ca11', blockCreated: 10299530 }, testnet: true }; const goerli = { id: chainId.goerli, name: 'Goerli', network: 'goerli', nativeCurrency: { name: 'Goerli Ether', symbol: 'ETH', decimals: 18 }, rpcUrls: { alchemy: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.a.goerli, default: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.p.goerli, infura: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.i.goerli, public: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.p.goerli }, blockExplorers: { etherscan: etherscanBlockExplorers.goerli, default: etherscanBlockExplorers.goerli }, ens: { address: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e' }, multicall: { address: '0xca11bde05977b3631167028862be2a173976ca11', blockCreated: 6507670 }, testnet: true }; const kovan = { id: chainId.kovan, name: 'Kovan', network: 'kovan', nativeCurrency: { name: 'Kovan Ether', symbol: 'ETH', decimals: 18 }, rpcUrls: { alchemy: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.a.kovan, default: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.p.kovan, infura: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.i.kovan, public: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.p.kovan }, blockExplorers: { etherscan: etherscanBlockExplorers.kovan, default: etherscanBlockExplorers.kovan }, multicall: { address: '0xca11bde05977b3631167028862be2a173976ca11', blockCreated: 30285908 }, testnet: true }; const optimism = { id: chainId.optimism, name: 'Optimism', network: 'optimism', nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, rpcUrls: { alchemy: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.a.optimism, default: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.p.optimism, infura: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.i.optimism, public: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.p.optimism }, blockExplorers: { etherscan: etherscanBlockExplorers.optimism, default: etherscanBlockExplorers.optimism }, multicall: { address: '0xca11bde05977b3631167028862be2a173976ca11', blockCreated: 4286263 } }; const optimismKovan = { id: chainId.optimismKovan, name: 'Optimism Kovan', network: 'optimism-kovan', nativeCurrency: { name: 'Kovan Ether', symbol: 'ETH', decimals: 18 }, rpcUrls: { alchemy: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.a.optimismKovan, default: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.p.optimismKovan, infura: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.i.optimismKovan, public: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.p.optimismKovan }, blockExplorers: { etherscan: etherscanBlockExplorers.optimismKovan, default: etherscanBlockExplorers.optimismKovan }, multicall: { address: '0xca11bde05977b3631167028862be2a173976ca11', blockCreated: 1418387 }, testnet: true }; const optimismGoerli = { id: chainId.optimismGoerli, name: 'Optimism Goerli', network: 'optimism-goerli', nativeCurrency: { name: 'Goerli Ether', symbol: 'ETH', decimals: 18 }, rpcUrls: { alchemy: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.a.optimismGoerli, default: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.p.optimismGoerli, infura: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.i.optimismGoerli, public: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.p.optimismGoerli }, blockExplorers: { default: { name: 'Blockscout', url: 'https://blockscout.com/optimism/goerli' } }, multicall: { address: '0xca11bde05977b3631167028862be2a173976ca11', blockCreated: 49461 }, testnet: true }; const polygon = { id: chainId.polygon, name: 'Polygon', network: 'matic', nativeCurrency: { name: 'MATIC', symbol: 'MATIC', decimals: 18 }, rpcUrls: { alchemy: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.a.polygon, default: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.p.polygon, infura: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.i.polygon, public: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.p.polygon }, blockExplorers: { etherscan: etherscanBlockExplorers.polygon, default: etherscanBlockExplorers.polygon }, multicall: { address: '0xca11bde05977b3631167028862be2a173976ca11', blockCreated: 25770160 } }; const polygonMumbai = { id: chainId.polygonMumbai, name: 'Polygon Mumbai', network: 'maticmum', nativeCurrency: { name: 'MATIC', symbol: 'MATIC', decimals: 18 }, rpcUrls: { alchemy: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.a.polygonMumbai, default: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.p.polygonMumbai, infura: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.i.polygonMumbai, public: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.p.polygonMumbai }, blockExplorers: { etherscan: etherscanBlockExplorers.polygonMumbai, default: etherscanBlockExplorers.polygonMumbai }, multicall: { address: '0xca11bde05977b3631167028862be2a173976ca11', blockCreated: 25444704 }, testnet: true }; const arbitrum = { id: chainId.arbitrum, name: 'Arbitrum One', network: 'arbitrum', nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, rpcUrls: { alchemy: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.a.arbitrum, default: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.p.arbitrum, infura: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.i.arbitrum, public: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.p.arbitrum }, blockExplorers: { arbitrum: { name: 'Arbitrum Explorer', url: 'https://explorer.arbitrum.io' }, etherscan: etherscanBlockExplorers.arbitrum, default: etherscanBlockExplorers.arbitrum }, multicall: { address: '0xca11bde05977b3631167028862be2a173976ca11', blockCreated: 7654707 } }; const arbitrumRinkeby = { id: chainId.arbitrumRinkeby, name: 'Arbitrum Rinkeby', network: 'arbitrum-rinkeby', nativeCurrency: { name: 'Arbitrum Rinkeby Ether', symbol: 'ETH', decimals: 18 }, rpcUrls: { alchemy: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.a.arbitrumRinkeby, default: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.p.arbitrumRinkeby, infura: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.i.arbitrumRinkeby, public: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.p.arbitrumRinkeby }, blockExplorers: { arbitrum: { name: 'Arbitrum Explorer', url: 'https://rinkeby-explorer.arbitrum.io' }, etherscan: etherscanBlockExplorers.arbitrumRinkeby, default: etherscanBlockExplorers.arbitrumRinkeby }, multicall: { address: '0xca11bde05977b3631167028862be2a173976ca11', blockCreated: 10228837 }, testnet: true }; const arbitrumGoerli = { id: chainId.arbitrumGoerli, name: 'Arbitrum Goerli', network: 'arbitrum-goerli', nativeCurrency: { name: 'Arbitrum Goerli Ether', symbol: 'ETH', decimals: 18 }, rpcUrls: { alchemy: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.a.arbitrumGoerli, default: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.p.arbitrumGoerli, infura: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.i.arbitrumGoerli, public: _rpcs_e837abf2_esm_js__WEBPACK_IMPORTED_MODULE_0__.p.arbitrumGoerli }, blockExplorers: { default: { name: 'Arbitrum Explorer', url: 'https://goerli-rollup-explorer.arbitrum.io' } }, multicall: { address: '0xca11bde05977b3631167028862be2a173976ca11', blockCreated: 88114 }, testnet: true }; const localhost = { id: chainId.localhost, name: 'Localhost', network: 'localhost', rpcUrls: { default: 'http://127.0.0.1:8545' } }; const hardhat = { id: chainId.hardhat, name: 'Hardhat', network: 'hardhat', rpcUrls: { default: 'http://127.0.0.1:8545' } }; const foundry = { id: chainId.foundry, name: 'Foundry', network: 'foundry', rpcUrls: { default: 'http://127.0.0.1:8545' } }; /** * Common chains for convenience * Should not contain all possible chains */ const chain = { mainnet, ropsten, rinkeby, goerli, kovan, optimism, optimismGoerli, optimismKovan, polygon, polygonMumbai, arbitrum, arbitrumGoerli, arbitrumRinkeby, localhost, hardhat, foundry }; const allChains = [mainnet, ropsten, rinkeby, goerli, kovan, optimism, optimismKovan, optimismGoerli, polygon, polygonMumbai, arbitrum, arbitrumGoerli, arbitrumRinkeby, localhost, hardhat, foundry]; const defaultChains = [mainnet, ropsten, rinkeby, goerli, kovan]; const defaultL2Chains = [arbitrum, arbitrumRinkeby, arbitrumGoerli, optimism, optimismKovan, optimismGoerli]; /***/ }), /***/ 96093: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { "A": function() { return /* binding */ AddChainError; }, "C": function() { return /* binding */ ConnectorAlreadyConnectedError; }, "I": function() { return /* binding */ InjectedConnector; }, "P": function() { return /* binding */ ProviderChainsNotFound; }, "R": function() { return /* binding */ ResourceUnavailableError; }, "S": function() { return /* binding */ SwitchChainNotSupportedError; }, "U": function() { return /* binding */ UserRejectedRequestError; }, "_": function() { return /* binding */ _classPrivateMethodInitSpec; }, "a": function() { return /* binding */ ConnectorNotFoundError; }, "b": function() { return /* binding */ ChainMismatchError; }, "c": function() { return /* binding */ ContractMethodDoesNotExistError; }, "d": function() { return /* binding */ getProvider; }, "e": function() { return /* binding */ ChainDoesNotSupportMulticallError; }, "f": function() { return /* binding */ ContractMethodNoResultError; }, "g": function() { return /* binding */ getClient; }, "h": function() { return /* binding */ createClient; }, "i": function() { return /* binding */ Client; }, "j": function() { return /* binding */ Connector; }, "k": function() { return /* binding */ ChainNotConfiguredError; }, "l": function() { return /* binding */ ProviderRpcError; }, "m": function() { return /* binding */ RpcError; }, "n": function() { return /* binding */ normalizeChainId; }, "o": function() { return /* binding */ SwitchChainError; }, "p": function() { return /* binding */ createStorage; }, "q": function() { return /* binding */ noopStorage; }, "r": function() { return /* binding */ _defineProperty; }, "s": function() { return /* binding */ _classPrivateFieldInitSpec; }, "t": function() { return /* binding */ _classPrivateFieldGet; }, "u": function() { return /* binding */ _classPrivateFieldSet; }, "v": function() { return /* binding */ _classPrivateMethodGet; } }); ;// CONCATENATED MODULE: ./node_modules/zustand/esm/middleware.js var __defProp$1 = Object.defineProperty; var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols; var __hasOwnProp$2 = Object.prototype.hasOwnProperty; var __propIsEnum$2 = Object.prototype.propertyIsEnumerable; var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$1 = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$2.call(b, prop)) __defNormalProp$1(a, prop, b[prop]); if (__getOwnPropSymbols$2) for (var prop of __getOwnPropSymbols$2(b)) { if (__propIsEnum$2.call(b, prop)) __defNormalProp$1(a, prop, b[prop]); } return a; }; const reduxImpl = (reducer, initial) => (set, get, api) => { api.dispatch = (action) => { set((state) => reducer(state, action), false, action); return action; }; api.dispatchFromDevtools = true; return __spreadValues$1({ dispatch: (...a) => api.dispatch(...a) }, initial); }; const redux = (/* unused pure expression or super */ null && (reduxImpl)); var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols; var __hasOwnProp$1 = Object.prototype.hasOwnProperty; var __propIsEnum$1 = Object.prototype.propertyIsEnumerable; var __objRest = (source, exclude) => { var target = {}; for (var prop in source) if (__hasOwnProp$1.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop]; if (source != null && __getOwnPropSymbols$1) for (var prop of __getOwnPropSymbols$1(source)) { if (exclude.indexOf(prop) < 0 && __propIsEnum$1.call(source, prop)) target[prop] = source[prop]; } return target; }; const devtoolsImpl = (fn, devtoolsOptions = {}) => (set, get, api) => { const _a = devtoolsOptions, { enabled, anonymousActionType } = _a, options = __objRest(_a, ["enabled", "anonymousActionType"]); let extensionConnector; try { extensionConnector = (enabled != null ? enabled : (/* unsupported import.meta.env */ undefined && 0) !== "production") && window.__REDUX_DEVTOOLS_EXTENSION__; } catch { } if (!extensionConnector) { if ( true && enabled) { console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"); } return fn(set, get, api); } const extension = extensionConnector.connect(options); let isRecording = true; api.setState = (state, replace, nameOrAction) => { const r = set(state, replace); if (!isRecording) return r; extension.send(nameOrAction === void 0 ? { type: anonymousActionType || "anonymous" } : typeof nameOrAction === "string" ? { type: nameOrAction } : nameOrAction, get()); return r; }; const setStateFromDevtools = (...a) => { const originalIsRecording = isRecording; isRecording = false; set(...a); isRecording = originalIsRecording; }; const initialState = fn(api.setState, get, api); extension.init(initialState); if (api.dispatchFromDevtools && typeof api.dispatch === "function") { let didWarnAboutReservedActionType = false; const originalDispatch = api.dispatch; api.dispatch = (...a) => { if ( true && a[0].type === "__setState" && !didWarnAboutReservedActionType) { console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'); didWarnAboutReservedActionType = true; } originalDispatch(...a); }; } extension.subscribe((message) => { var _a2; switch (message.type) { case "ACTION": if (typeof message.payload !== "string") { console.error("[zustand devtools middleware] Unsupported action format"); return; } return parseJsonThen(message.payload, (action) => { if (action.type === "__setState") { setStateFromDevtools(action.state); return; } if (!api.dispatchFromDevtools) return; if (typeof api.dispatch !== "function") return; api.dispatch(action); }); case "DISPATCH": switch (message.payload.type) { case "RESET": setStateFromDevtools(initialState); return extension.init(api.getState()); case "COMMIT": return extension.init(api.getState()); case "ROLLBACK": return parseJsonThen(message.state, (state) => { setStateFromDevtools(state); extension.init(api.getState()); }); case "JUMP_TO_STATE": case "JUMP_TO_ACTION": return parseJsonThen(message.state, (state) => { setStateFromDevtools(state); }); case "IMPORT_STATE": { const { nextLiftedState } = message.payload; const lastComputedState = (_a2 = nextLiftedState.computedStates.slice(-1)[0]) == null ? void 0 : _a2.state; if (!lastComputedState) return; setStateFromDevtools(lastComputedState); extension.send(null, nextLiftedState); return; } case "PAUSE_RECORDING": return isRecording = !isRecording; } return; } }); return initialState; }; const devtools = (/* unused pure expression or super */ null && (devtoolsImpl)); const parseJsonThen = (stringified, f) => { let parsed; try { parsed = JSON.parse(stringified); } catch (e) { console.error("[zustand devtools middleware] Could not parse the received json", e); } if (parsed !== void 0) f(parsed); }; const subscribeWithSelectorImpl = (fn) => (set, get, api) => { const origSubscribe = api.subscribe; api.subscribe = (selector, optListener, options) => { let listener = selector; if (optListener) { const equalityFn = (options == null ? void 0 : options.equalityFn) || Object.is; let currentSlice = selector(api.getState()); listener = (state) => { const nextSlice = selector(state); if (!equalityFn(currentSlice, nextSlice)) { const previousSlice = currentSlice; optListener(currentSlice = nextSlice, previousSlice); } }; if (options == null ? void 0 : options.fireImmediately) { optListener(currentSlice, currentSlice); } } return origSubscribe(listener); }; const initialState = fn(set, get, api); return initialState; }; const subscribeWithSelector = subscribeWithSelectorImpl; const combine = (initialState, create) => (...a) => Object.assign({}, initialState, create(...a)); var __defProp = Object.defineProperty; var __getOwnPropSymbols = Object.getOwnPropertySymbols; var __hasOwnProp = Object.prototype.hasOwnProperty; var __propIsEnum = Object.prototype.propertyIsEnumerable; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]); if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) { if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]); } return a; }; const toThenable = (fn) => (input) => { try { const result = fn(input); if (result instanceof Promise) { return result; } return { then(onFulfilled) { return toThenable(onFulfilled)(result); }, catch(_onRejected) { return this; } }; } catch (e) { return { then(_onFulfilled) { return this; }, catch(onRejected) { return toThenable(onRejected)(e); } }; } }; const persistImpl = (config, baseOptions) => (set, get, api) => { let options = __spreadValues({ getStorage: () => localStorage, serialize: JSON.stringify, deserialize: JSON.parse, partialize: (state) => state, version: 0, merge: (persistedState, currentState) => __spreadValues(__spreadValues({}, currentState), persistedState) }, baseOptions); let hasHydrated = false; const hydrationListeners = /* @__PURE__ */ new Set(); const finishHydrationListeners = /* @__PURE__ */ new Set(); let storage; try { storage = options.getStorage(); } catch (e) { } if (!storage) { return config((...args) => { console.warn(`[zustand persist middleware] Unable to update item '${options.name}', the given storage is currently unavailable.`); set(...args); }, get, api); } const thenableSerialize = toThenable(options.serialize); const setItem = () => { const state = options.partialize(__spreadValues({}, get())); let errorInSync; const thenable = thenableSerialize({ state, version: options.version }).then((serializedValue) => storage.setItem(options.name, serializedValue)).catch((e) => { errorInSync = e; }); if (errorInSync) { throw errorInSync; } return thenable; }; const savedSetState = api.setState; api.setState = (state, replace) => { savedSetState(state, replace); void setItem(); }; const configResult = config((...args) => { set(...args); void setItem(); }, get, api); let stateFromStorage; const hydrate = () => { var _a; if (!storage) return; hasHydrated = false; hydrationListeners.forEach((cb) => cb(get())); const postRehydrationCallback = ((_a = options.onRehydrateStorage) == null ? void 0 : _a.call(options, get())) || void 0; return toThenable(storage.getItem.bind(storage))(options.name).then((storageValue) => { if (storageValue) { return options.deserialize(storageValue); } }).then((deserializedStorageValue) => { if (deserializedStorageValue) { if (typeof deserializedStorageValue.version === "number" && deserializedStorageValue.version !== options.version) { if (options.migrate) { return options.migrate(deserializedStorageValue.state, deserializedStorageValue.version); } console.error(`State loaded from storage couldn't be migrated since no migrate function was provided`); } else { return deserializedStorageValue.state; } } }).then((migratedState) => { var _a2; stateFromStorage = options.merge(migratedState, (_a2 = get()) != null ? _a2 : configResult); set(stateFromStorage, true); return setItem(); }).then(() => { postRehydrationCallback == null ? void 0 : postRehydrationCallback(stateFromStorage, void 0); hasHydrated = true; finishHydrationListeners.forEach((cb) => cb(stateFromStorage)); }).catch((e) => { postRehydrationCallback == null ? void 0 : postRehydrationCallback(void 0, e); }); }; api.persist = { setOptions: (newOptions) => { options = __spreadValues(__spreadValues({}, options), newOptions); if (newOptions.getStorage) { storage = newOptions.getStorage(); } }, clearStorage: () => { storage == null ? void 0 : storage.removeItem(options.name); }, rehydrate: () => hydrate(), hasHydrated: () => hasHydrated, onHydrate: (cb) => { hydrationListeners.add(cb); return () => { hydrationListeners.delete(cb); }; }, onFinishHydration: (cb) => { finishHydrationListeners.add(cb); return () => { finishHydrationListeners.delete(cb); }; } }; hydrate(); return stateFromStorage || configResult; }; const persist = persistImpl; ;// CONCATENATED MODULE: ./node_modules/zustand/esm/vanilla.js const createStoreImpl = (createState) => { let state; const listeners = /* @__PURE__ */ new Set(); const setState = (partial, replace) => { const nextState = typeof partial === "function" ? partial(state) : partial; if (nextState !== state) { const previousState = state; state = replace ? nextState : Object.assign({}, state, nextState); listeners.forEach((listener) => listener(state, previousState)); } }; const getState = () => state; const subscribe = (listener) => { listeners.add(listener); return () => listeners.delete(listener); }; const destroy = () => listeners.clear(); const api = { setState, getState, subscribe, destroy }; state = createState(setState, getState, api); return api; }; const createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl; // EXTERNAL MODULE: ./node_modules/@ethersproject/providers/lib.esm/web3-provider.js var web3_provider = __webpack_require__(241); // EXTERNAL MODULE: ./node_modules/ethers/lib/utils.js var utils = __webpack_require__(56371); // EXTERNAL MODULE: ./node_modules/eventemitter3/index.js var eventemitter3 = __webpack_require__(26729); var eventemitter3_default = /*#__PURE__*/__webpack_require__.n(eventemitter3); // EXTERNAL MODULE: ./node_modules/@wagmi/core/dist/chains-505e1070.esm.js var chains_505e1070_esm = __webpack_require__(98392); ;// CONCATENATED MODULE: ./node_modules/@wagmi/core/dist/getProvider-e3d84eba.esm.js function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } } function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); } function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; } function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); } function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); } function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; } function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } } function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; } /** * Error subclass implementing JSON RPC 2.0 errors and Ethereum RPC errors per EIP-1474. * @see https://eips.ethereum.org/EIPS/eip-1474 */ class RpcError extends Error { constructor( /** Number error code */ code, /** Human-readable string */ message, /** Low-level error */ internal, /** Other useful information about error */ data) { if (!Number.isInteger(code)) throw new Error('"code" must be an integer.'); if (!message || typeof message !== 'string') throw new Error('"message" must be a nonempty string.'); super(message); _defineProperty(this, "code", void 0); _defineProperty(this, "data", void 0); _defineProperty(this, "internal", void 0); this.code = code; this.data = data; this.internal = internal; } } /** * Error subclass implementing Ethereum Provider errors per EIP-1193. * @see https://eips.ethereum.org/EIPS/eip-1193 */ class ProviderRpcError extends RpcError { /** * Create an Ethereum Provider JSON-RPC error. * `code` must be an integer in the 1000 <= 4999 range. */ constructor( /** * Number error code * @see https://eips.ethereum.org/EIPS/eip-1193#error-standards */ code, /** Human-readable string */ message, /** Low-level error */ internal, /** Other useful information about error */ data) { if (!(Number.isInteger(code) && code >= 1000 && code <= 4999)) throw new Error('"code" must be an integer such that: 1000 <= code <= 4999'); super(code, message, internal, data); } } class AddChainError extends Error { constructor() { super(...arguments); _defineProperty(this, "name", 'AddChainError'); _defineProperty(this, "message", 'Error adding chain'); } } class ChainDoesNotSupportMulticallError extends Error { constructor(_ref) { let { blockNumber, chain } = _ref; super("Chain \"".concat(chain.name, "\" does not support multicall").concat(blockNumber ? " on block ".concat(blockNumber) : '', ".")); _defineProperty(this, "name", 'ChainDoesNotSupportMulticall'); } } class ChainMismatchError extends Error { constructor(_ref2) { let { activeChain, targetChain } = _ref2; super("Chain mismatch: Expected \"".concat(targetChain, "\", received \"").concat(activeChain, "\".")); _defineProperty(this, "name", 'ChainMismatchError'); } } class ChainNotConfiguredError extends Error { constructor() { super(...arguments); _defineProperty(this, "name", 'ChainNotConfigured'); _defineProperty(this, "message", 'Chain not configured'); } } class ConnectorAlreadyConnectedError extends Error { constructor() { super(...arguments); _defineProperty(this, "name", 'ConnectorAlreadyConnectedError'); _defineProperty(this, "message", 'Connector already connected'); } } class ConnectorNotFoundError extends Error { constructor() { super(...arguments); _defineProperty(this, "name", 'ConnectorNotFoundError'); _defineProperty(this, "message", 'Connector not found'); } } class ContractMethodDoesNotExistError extends Error { constructor(_ref3) { var _chain$blockExplorers; let { addressOrName, chainId, functionName } = _ref3; const { chains, network } = getProvider(); const chain = chains === null || chains === void 0 ? void 0 : chains.find(_ref4 => { let { id } = _ref4; return id === (chainId || network.chainId); }); const blockExplorer = chain === null || chain === void 0 ? void 0 : (_chain$blockExplorers = chain.blockExplorers) === null || _chain$blockExplorers === void 0 ? void 0 : _chain$blockExplorers.default; super(["Function \"".concat(functionName, "\" on contract \"").concat(addressOrName, "\" does not exist."), ...(blockExplorer ? ['', "".concat(blockExplorer === null || blockExplorer === void 0 ? void 0 : blockExplorer.name, ": ").concat(blockExplorer === null || blockExplorer === void 0 ? void 0 : blockExplorer.url, "/address/").concat(addressOrName, "#readContract")] : [])].join('\n')); _defineProperty(this, "name", 'ContractMethodDoesNotExistError'); } } class ContractMethodNoResultError extends Error { constructor(_ref5) { var _chain$blockExplorers2; let { addressOrName, chainId, functionName } = _ref5; const { chains, network } = getProvider(); const chain = chains === null || chains === void 0 ? void 0 : chains.find(_ref6 => { let { id } = _ref6; return id === (chainId || network.chainId); }); const blockExplorer = chain === null || chain === void 0 ? void 0 : (_chain$blockExplorers2 = chain.blockExplorers) === null || _chain$blockExplorers2 === void 0 ? void 0 : _chain$blockExplorers2.default; super(["Function \"".concat(functionName, "\" on contract \"").concat(addressOrName, "\" returned an empty response."), '', "Are you sure the function \"".concat(functionName, "\" exists on this contract?"), ...(blockExplorer ? ['', "".concat(blockExplorer === null || blockExplorer === void 0 ? void 0 : blockExplorer.name, ": ").concat(blockExplorer === null || blockExplorer === void 0 ? void 0 : blockExplorer.url, "/address/").concat(addressOrName, "#readContract")] : [])].join('\n')); _defineProperty(this, "name", 'ContractMethodNoResultError'); } } class ProviderChainsNotFound extends Error { constructor() { super(...arguments); _defineProperty(this, "name", 'ProviderChainsNotFound'); _defineProperty(this, "message", ['No chains were found on the wagmi provider. Some functions that require a chain may not work.', '', 'It is recommended to add a list of chains to the provider in `createClient`.', '', 'Example:', '', '```', "import { getDefaultProvider } from 'ethers'", "import { chain, createClient } from 'wagmi'", '', 'createClient({', ' provider: Object.assign(getDefaultProvider(), { chains: [chain.mainnet] })', '})', '```'].join('\n')); } } class ResourceUnavailableError extends RpcError { constructor(error) { super(-32002, 'Resource unavailable', error); _defineProperty(this, "name", 'ResourceUnavailable'); } } class SwitchChainError extends ProviderRpcError { constructor(error) { super(4902, 'Error switching chain', error); _defineProperty(this, "name", 'SwitchChainError'); } } class SwitchChainNotSupportedError extends Error { constructor(_ref7) { let { connector } = _ref7; super("\"".concat(connector.name, "\" does not support programmatic chain switching.")); _defineProperty(this, "name", 'SwitchChainNotSupportedError'); } } class UserRejectedRequestError extends ProviderRpcError { constructor(error) { super(4001, 'User rejected request', error); _defineProperty(this, "name", 'UserRejectedRequestError'); } } function getInjectedName(ethereum) { var _ethereum$providers, _getName; if (!ethereum) return 'Injected'; const getName = provider => { if (provider.isBraveWallet) return 'Brave Wallet'; if (provider.isCoinbaseWallet) return 'Coinbase Wallet'; if (provider.isExodus) return 'Exodus'; if (provider.isFrame) return 'Frame'; if (provider.isOpera) return 'Opera'; if (provider.isTally) return 'Tally'; if (provider.isTokenPocket) return 'TokenPocket'; if (provider.isTokenary) return 'Tokenary'; if (provider.isTrust) return 'Trust Wallet'; if (provider.isOneInchIOSWallet || provider.isOneInchAndroidWallet) return '1inch Wallet'; if (provider.isMetaMask) return 'MetaMask'; }; // Some injected providers detect multiple other providers and create a list at `ethers.providers` if ((_ethereum$providers = ethereum.providers) !== null && _ethereum$providers !== void 0 && _ethereum$providers.length) { var _names$; // Deduplicate names using Set // Coinbase Wallet puts multiple providers in `ethereum.providers` const nameSet = new Set(); let unknownCount = 1; for (const provider of ethereum.providers) { let name = getName(provider); if (!name) { name = "Unknown Wallet #".concat(unknownCount); unknownCount += 1; } nameSet.add(name); } const names = [...nameSet]; if (names.length) return names; return (_names$ = names[0]) !== null && _names$ !== void 0 ? _names$ : 'Injected'; } return (_getName = getName(ethereum)) !== null && _getName !== void 0 ? _getName : 'Injected'; } function normalizeChainId(chainId) { if (typeof chainId === 'string') return Number.parseInt(chainId, chainId.trim().substring(0, 2) === '0x' ? 16 : 10); if (typeof chainId === 'bigint') return Number(chainId); return chainId; } class Connector extends (eventemitter3_default()) { /** Unique connector id */ /** Connector name */ /** Chains connector supports */ /** Options to use with connector */ /** Whether connector is usable */ constructor(_ref) { let { chains = chains_505e1070_esm.d, options } = _ref; super(); _defineProperty(this, "id", void 0); _defineProperty(this, "name", void 0); _defineProperty(this, "chains", void 0); _defineProperty(this, "options", void 0); _defineProperty(this, "ready", void 0); this.chains = chains; this.options = options; } getBlockExplorerUrls(chain) { var _chain$blockExplorers; const { default: blockExplorer, ...blockExplorers } = (_chain$blockExplorers = chain.blockExplorers) !== null && _chain$blockExplorers !== void 0 ? _chain$blockExplorers : {}; if (blockExplorer) return [blockExplorer.url, ...Object.values(blockExplorers).map(x => x.url)]; return []; } isChainUnsupported(chainId) { return !this.chains.some(x => x.id === chainId); } } var _provider = /*#__PURE__*/new WeakMap(); var _switchingChains = /*#__PURE__*/new WeakMap(); class InjectedConnector extends Connector { constructor() { let { chains, options = { shimDisconnect: true } } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; super({ chains, options }); _defineProperty(this, "id", void 0); _defineProperty(this, "name", void 0); _defineProperty(this, "ready", typeof window != 'undefined' && !!window.ethereum); _classPrivateFieldInitSpec(this, _provider, { writable: true, value: void 0 }); _classPrivateFieldInitSpec(this, _switchingChains, { writable: true, value: void 0 }); _defineProperty(this, "shimDisconnectKey", 'injected.shimDisconnect'); _defineProperty(this, "onAccountsChanged", accounts => { if (accounts.length === 0) this.emit('disconnect');else this.emit('change', { account: (0,utils.getAddress)(accounts[0]) }); }); _defineProperty(this, "onChainChanged", chainId => { const id = normalizeChainId(chainId); const unsupported = this.isChainUnsupported(id); this.emit('change', { chain: { id, unsupported } }); }); _defineProperty(this, "onDisconnect", () => { var _this$options, _this$options2, _getClient$storage; // We need this as MetaMask can emit the "disconnect" event // upon switching chains. This workaround ensures that the // user currently isn't in the process of switching chains. if ((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.shimChainChangedDisconnect && _classPrivateFieldGet(this, _switchingChains)) { _classPrivateFieldSet(this, _switchingChains, false); return; } this.emit('disconnect'); // Remove shim signalling wallet is disconnected if ((_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.shimDisconnect) (_getClient$storage = getClient().storage) === null || _getClient$storage === void 0 ? void 0 : _getClient$storage.removeItem(this.shimDisconnectKey); }); let name = 'Injected'; const overrideName = options.name; if (typeof overrideName === 'string') name = overrideName;else if (typeof window !== 'undefined') { const detectedName = getInjectedName(window.ethereum); if (overrideName) name = overrideName(detectedName);else name = typeof detectedName === 'string' ? detectedName : detectedName[0]; } this.id = 'injected'; this.name = name; } async connect() { let { chainId } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; try { var _this$options3, _getClient$storage2; const provider = await this.getProvider(); if (!provider) throw new ConnectorNotFoundError(); if (provider.on) { provider.on('accountsChanged', this.onAccountsChanged); provider.on('chainChanged', this.onChainChanged); provider.on('disconnect', this.onDisconnect); } this.emit('message', { type: 'connecting' }); const account = await this.getAccount(); // Switch to chain if provided let id = await this.getChainId(); let unsupported = this.isChainUnsupported(id); if (chainId && id !== chainId) { const chain = await this.switchChain(chainId); id = chain.id; unsupported = this.isChainUnsupported(id); } // Add shim to storage signalling wallet is connected if ((_this$options3 = this.options) !== null && _this$options3 !== void 0 && _this$options3.shimDisconnect) (_getClient$storage2 = getClient().storage) === null || _getClient$storage2 === void 0 ? void 0 : _getClient$storage2.setItem(this.shimDisconnectKey, true); return { account, chain: { id, unsupported }, provider }; } catch (error) { if (this.isUserRejectedRequestError(error)) throw new UserRejectedRequestError(error); if (error.code === -32002) throw new ResourceUnavailableError(error); throw error; } } async disconnect() { var _this$options4, _getClient$storage3; const provider = await this.getProvider(); if (!(provider !== null && provider !== void 0 && provider.removeListener)) return; provider.removeListener('accountsChanged', this.onAccountsChanged); provider.removeListener('chainChanged', this.onChainChanged); provider.removeListener('disconnect', this.onDisconnect); // Remove shim signalling wallet is disconnected if ((_this$options4 = this.options) !== null && _this$options4 !== void 0 && _this$options4.shimDisconnect) (_getClient$storage3 = getClient().storage) === null || _getClient$storage3 === void 0 ? void 0 : _getClient$storage3.removeItem(this.shimDisconnectKey); } async getAccount() { const provider = await this.getProvider(); if (!provider) throw new ConnectorNotFoundError(); const accounts = await provider.request({ method: 'eth_requestAccounts' }); // return checksum address return (0,utils.getAddress)(accounts[0]); } async getChainId() { const provider = await this.getProvider(); if (!provider) throw new ConnectorNotFoundError(); return await provider.request({ method: 'eth_chainId' }).then(normalizeChainId); } async getProvider() { if (typeof window !== 'undefined' && !!window.ethereum) _classPrivateFieldSet(this, _provider, window.ethereum); return _classPrivateFieldGet(this, _provider); } async getSigner() { const [provider, account] = await Promise.all([this.getProvider(), this.getAccount()]); return new web3_provider/* Web3Provider */.Q(provider).getSigner(account); } async isAuthorized() { try { var _this$options5, _getClient$storage4; if ((_this$options5 = this.options) !== null && _this$options5 !== void 0 && _this$options5.shimDisconnect && // If shim does not exist in storage, wallet is disconnected !((_getClient$storage4 = getClient().storage) !== null && _getClient$storage4 !== void 0 && _getClient$storage4.getItem(this.shimDisconnectKey))) return false; const provider = await this.getProvider(); if (!provider) throw new ConnectorNotFoundError(); const accounts = await provider.request({ method: 'eth_accounts' }); const account = accounts[0]; return !!account; } catch { return false; } } async switchChain(chainId) { var _this$options6; if ((_this$options6 = this.options) !== null && _this$options6 !== void 0 && _this$options6.shimChainChangedDisconnect) _classPrivateFieldSet(this, _switchingChains, true); const provider = await this.getProvider(); if (!provider) throw new ConnectorNotFoundError(); const id = (0,utils.hexValue)(chainId); try { var _this$chains$find; await provider.request({ method: 'wallet_switchEthereumChain', params: [{ chainId: id }] }); return (_this$chains$find = this.chains.find(x => x.id === chainId)) !== null && _this$chains$find !== void 0 ? _this$chains$find : { id: chainId, name: "Chain ".concat(id), network: "".concat(id), rpcUrls: { default: '' } }; } catch (error) { var _data, _data$originalError; const chain = this.chains.find(x => x.id === chainId); if (!chain) throw new ChainNotConfiguredError(); // Indicates chain is not added to provider if (error.code === 4902 || // Unwrapping for MetaMask Mobile // https://github.com/MetaMask/metamask-mobile/issues/2944#issuecomment-976988719 (error === null || error === void 0 ? void 0 : (_data = error.data) === null || _data === void 0 ? void 0 : (_data$originalError = _data.originalError) === null || _data$originalError === void 0 ? void 0 : _data$originalError.code) === 4902) { try { var _chain$rpcUrls$public; await provider.request({ method: 'wallet_addEthereumChain', params: [{ chainId: id, chainName: chain.name, nativeCurrency: chain.nativeCurrency, rpcUrls: [(_chain$rpcUrls$public = chain.rpcUrls.public) !== null && _chain$rpcUrls$public !== void 0 ? _chain$rpcUrls$public : chain.rpcUrls.default], blockExplorerUrls: this.getBlockExplorerUrls(chain) }] }); return chain; } catch (addError) { if (this.isUserRejectedRequestError(addError)) throw new UserRejectedRequestError(error); throw new AddChainError(); } } if (this.isUserRejectedRequestError(error)) throw new UserRejectedRequestError(error); throw new SwitchChainError(error); } } async watchAsset(_ref) { let { address, decimals = 18, image, symbol } = _ref; const provider = await this.getProvider(); if (!provider) throw new ConnectorNotFoundError(); return await provider.request({ method: 'wallet_watchAsset', params: { type: 'ERC20', options: { address, decimals, image, symbol } } }); } isUserRejectedRequestError(error) { return error.code === 4001; } } const noopStorage = { getItem: _key => '', setItem: (_key, _value) => null, removeItem: _key => null }; function createStorage(_ref) { let { storage, key: prefix = 'wagmi' } = _ref; return { ...storage, getItem: function (key) { let defaultState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; const value = storage.getItem("".concat(prefix, ".").concat(key)); try { return value ? JSON.parse(value) : defaultState; } catch (error) { console.warn(error); return defaultState; } }, setItem: (key, value) => { if (value === null) { storage.removeItem("".concat(prefix, ".").concat(key)); } else { try { storage.setItem("".concat(prefix, ".").concat(key), JSON.stringify(value)); } catch (err) { console.error(err); } } }, removeItem: key => storage.removeItem("".concat(prefix, ".").concat(key)) }; } const storeKey = 'store'; var _isAutoConnecting = /*#__PURE__*/new WeakMap(); var _lastUsedConnector = /*#__PURE__*/new WeakMap(); var _addEffects = /*#__PURE__*/new WeakSet(); class Client { constructor(_ref) { let { autoConnect = false, connectors = [new InjectedConnector()], provider: _provider, storage = createStorage({ storage: typeof window !== 'undefined' ? window.localStorage : noopStorage }), webSocketProvider: _webSocketProvider } = _ref; _classPrivateMethodInitSpec(this, _addEffects); _defineProperty(this, "config", void 0); _defineProperty(this, "storage", void 0); _defineProperty(this, "store", void 0); _classPrivateFieldInitSpec(this, _isAutoConnecting, { writable: true, value: void 0 }); _classPrivateFieldInitSpec(this, _lastUsedConnector, { writable: true, value: void 0 }); // Check status for autoConnect flag let status = 'disconnected'; let _chainId; if (autoConnect) { try { var _JSON$parse, _JSON$parse$state, _data$chain; const rawState = storage.getItem(storeKey, ''); const data = (_JSON$parse = JSON.parse(rawState || '{}')) === null || _JSON$parse === void 0 ? void 0 : (_JSON$parse$state = _JSON$parse.state) === null || _JSON$parse$state === void 0 ? void 0 : _JSON$parse$state.data; // If account exists in localStorage, set status to reconnecting status = data !== null && data !== void 0 && data.account ? 'reconnecting' : 'connecting'; _chainId = data === null || data === void 0 ? void 0 : (_data$chain = data.chain) === null || _data$chain === void 0 ? void 0 : _data$chain.id; // eslint-disable-next-line no-empty } catch (_error) {} } // Create store this.store = createStore(subscribeWithSelector(persist(() => ({ connectors: typeof connectors === 'function' ? connectors() : connectors, provider: typeof _provider === 'function' ? _provider({ chainId: _chainId }) : _provider, status, webSocketProvider: typeof _webSocketProvider === 'function' ? _webSocketProvider({ chainId: _chainId }) : _webSocketProvider }), { name: storeKey, getStorage: () => storage, partialize: state => { var _state$data, _state$data2; return { ...(autoConnect && { data: { account: state === null || state === void 0 ? void 0 : (_state$data = state.data) === null || _state$data === void 0 ? void 0 : _state$data.account, chain: state === null || state === void 0 ? void 0 : (_state$data2 = state.data) === null || _state$data2 === void 0 ? void 0 : _state$data2.chain } }), chains: state === null || state === void 0 ? void 0 : state.chains }; }, version: 1 }))); this.config = { autoConnect, connectors, provider: _provider, storage, webSocketProvider: _webSocketProvider }; this.storage = storage; _classPrivateFieldSet(this, _lastUsedConnector, storage === null || storage === void 0 ? void 0 : storage.getItem('wallet')); _classPrivateMethodGet(this, _addEffects, _addEffects2).call(this); if (autoConnect && typeof window !== 'undefined') setTimeout(async () => await this.autoConnect(), 0); } get chains() { return this.store.getState().chains; } get connectors() { return this.store.getState().connectors; } get connector() { return this.store.getState().connector; } get data() { return this.store.getState().data; } get error() { return this.store.getState().error; } get lastUsedChainId() { var _this$data, _this$data$chain; return (_this$data = this.data) === null || _this$data === void 0 ? void 0 : (_this$data$chain = _this$data.chain) === null || _this$data$chain === void 0 ? void 0 : _this$data$chain.id; } get provider() { return this.store.getState().provider; } get status() { return this.store.getState().status; } get subscribe() { return this.store.subscribe; } get webSocketProvider() { return this.store.getState().webSocketProvider; } setState(updater) { const newState = typeof updater === 'function' ? updater(this.store.getState()) : updater; this.store.setState(newState, true); } clearState() { this.setState(x => ({ ...x, connector: undefined, data: undefined, error: undefined, status: 'disconnected' })); } async destroy() { var _this$connector$disco, _this$connector; if (this.connector) await ((_this$connector$disco = (_this$connector = this.connector).disconnect) === null || _this$connector$disco === void 0 ? void 0 : _this$connector$disco.call(_this$connector)); _classPrivateFieldSet(this, _isAutoConnecting, false); this.clearState(); this.store.destroy(); } async autoConnect() { if (_classPrivateFieldGet(this, _isAutoConnecting)) return; _classPrivateFieldSet(this, _isAutoConnecting, true); this.setState(x => { var _x$data; return { ...x, status: (_x$data = x.data) !== null && _x$data !== void 0 && _x$data.account ? 'reconnecting' : 'connecting' }; }); // Try last used connector first const sorted = _classPrivateFieldGet(this, _lastUsedConnector) ? [...this.connectors].sort(x => x.id === _classPrivateFieldGet(this, _lastUsedConnector) ? -1 : 1) : this.connectors; let connected = false; for (const connector of sorted) { if (!connector.ready || !connector.isAuthorized) continue; const isAuthorized = await connector.isAuthorized(); if (!isAuthorized) continue; const data = await connector.connect(); this.setState(x => ({ ...x, connector, chains: connector === null || connector === void 0 ? void 0 : connector.chains, data, status: 'connected' })); connected = true; break; } // If connecting didn't succeed, set to disconnected if (!connected) this.setState(x => ({ ...x, data: undefined, status: 'disconnected' })); _classPrivateFieldSet(this, _isAutoConnecting, false); return this.data; } setLastUsedConnector() { var _this$storage; let lastUsedConnector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; (_this$storage = this.storage) === null || _this$storage === void 0 ? void 0 : _this$storage.setItem('wallet', lastUsedConnector); } } function _addEffects2() { const onChange = data => { this.setState(x => ({ ...x, data: { ...x.data, ...data } })); }; const onDisconnect = () => { this.clearState(); }; const onError = error => { this.setState(x => ({ ...x, error })); }; this.store.subscribe(_ref2 => { let { connector } = _ref2; return connector; }, (connector, prevConnector) => { var _prevConnector$off, _prevConnector$off2, _prevConnector$off3, _connector$on, _connector$on2, _connector$on3; prevConnector === null || prevConnector === void 0 ? void 0 : (_prevConnector$off = prevConnector.off) === null || _prevConnector$off === void 0 ? void 0 : _prevConnector$off.call(prevConnector, 'change', onChange); prevConnector === null || prevConnector === void 0 ? void 0 : (_prevConnector$off2 = prevConnector.off) === null || _prevConnector$off2 === void 0 ? void 0 : _prevConnector$off2.call(prevConnector, 'disconnect', onDisconnect); prevConnector === null || prevConnector === void 0 ? void 0 : (_prevConnector$off3 = prevConnector.off) === null || _prevConnector$off3 === void 0 ? void 0 : _prevConnector$off3.call(prevConnector, 'error', onError); if (!connector) return; (_connector$on = connector.on) === null || _connector$on === void 0 ? void 0 : _connector$on.call(connector, 'change', onChange); (_connector$on2 = connector.on) === null || _connector$on2 === void 0 ? void 0 : _connector$on2.call(connector, 'disconnect', onDisconnect); (_connector$on3 = connector.on) === null || _connector$on3 === void 0 ? void 0 : _connector$on3.call(connector, 'error', onError); }); const { provider, webSocketProvider } = this.config; const subscribeProvider = typeof provider === 'function'; const subscribeWebSocketProvider = typeof webSocketProvider === 'function'; if (subscribeProvider || subscribeWebSocketProvider) this.store.subscribe(_ref3 => { var _data$chain2; let { data } = _ref3; return data === null || data === void 0 ? void 0 : (_data$chain2 = data.chain) === null || _data$chain2 === void 0 ? void 0 : _data$chain2.id; }, chainId => { this.setState(x => ({ ...x, provider: subscribeProvider ? provider({ chainId }) : x.provider, webSocketProvider: subscribeWebSocketProvider ? webSocketProvider({ chainId }) : x.webSocketProvider })); }); } let client; function createClient(config) { const client_ = new Client(config); client = client_; return client_; } function getClient() { if (!client) { throw new Error('No wagmi client found. Ensure you have set up a client: https://wagmi.sh/docs/client'); } return client; } function getProvider() { let { chainId } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; const client = getClient(); if (chainId && typeof client.config.provider === 'function') return client.config.provider({ chainId }); return client.provider; } /***/ }), /***/ 87782: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "a": function() { return /* binding */ alchemyRpcUrls; }, /* harmony export */ "i": function() { return /* binding */ infuraRpcUrls; }, /* harmony export */ "p": function() { return /* binding */ publicRpcUrls; } /* harmony export */ }); /* unused harmony exports b, d */ const defaultAlchemyApiKey = '_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC'; const defaultInfuraApiKey = '84842078b09946638c03157f83405213'; const alchemyRpcUrls = { mainnet: 'https://eth-mainnet.alchemyapi.io/v2', ropsten: 'https://eth-ropsten.alchemyapi.io/v2', rinkeby: 'https://eth-rinkeby.alchemyapi.io/v2', goerli: 'https://eth-goerli.alchemyapi.io/v2', kovan: 'https://eth-kovan.alchemyapi.io/v2', optimism: 'https://opt-mainnet.g.alchemy.com/v2', optimismKovan: 'https://opt-kovan.g.alchemy.com/v2', optimismGoerli: 'https://opt-goerli.g.alchemy.com/v2', polygon: 'https://polygon-mainnet.g.alchemy.com/v2', polygonMumbai: 'https://polygon-mumbai.g.alchemy.com/v2', arbitrum: 'https://arb-mainnet.g.alchemy.com/v2', arbitrumRinkeby: 'https://arb-rinkeby.g.alchemy.com/v2', arbitrumGoerli: 'https://arb-goerli.g.alchemy.com/v2' }; const infuraRpcUrls = { mainnet: 'https://mainnet.infura.io/v3', ropsten: 'https://ropsten.infura.io/v3', rinkeby: 'https://rinkeby.infura.io/v3', goerli: 'https://goerli.infura.io/v3', kovan: 'https://kovan.infura.io/v3', optimism: 'https://optimism-mainnet.infura.io/v3', optimismKovan: 'https://optimism-kovan.infura.io/v3', optimismGoerli: 'https://optimism-goerli.infura.io/v3', polygon: 'https://polygon-mainnet.infura.io/v3', polygonMumbai: 'https://polygon-mumbai.infura.io/v3', arbitrum: 'https://arbitrum-mainnet.infura.io/v3', arbitrumRinkeby: 'https://arbitrum-rinkeby.infura.io/v3', arbitrumGoerli: 'https://arbitrum-goerli.infura.io/v3' }; const publicRpcUrls = { mainnet: "".concat(alchemyRpcUrls.mainnet, "/").concat(defaultAlchemyApiKey), ropsten: "".concat(alchemyRpcUrls.ropsten, "/").concat(defaultAlchemyApiKey), rinkeby: "".concat(alchemyRpcUrls.rinkeby, "/").concat(defaultAlchemyApiKey), goerli: "".concat(alchemyRpcUrls.goerli, "/").concat(defaultAlchemyApiKey), kovan: "".concat(alchemyRpcUrls.kovan, "/").concat(defaultAlchemyApiKey), optimism: 'https://mainnet.optimism.io', optimismKovan: 'https://kovan.optimism.io', optimismGoerli: 'https://goerli.optimism.io', polygon: 'https://polygon-rpc.com', polygonMumbai: 'https://matic-mumbai.chainstacklabs.com', arbitrum: 'https://arb1.arbitrum.io/rpc', arbitrumRinkeby: 'https://rinkeby.arbitrum.io/rpc', arbitrumGoerli: 'https://goerli-rollup.arbitrum.io/rpc' }; /***/ }), /***/ 1534: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { "AddChainError": function() { return /* reexport */ getProvider_e3d84eba_esm.A; }, "ChainDoesNotSupportMulticallError": function() { return /* reexport */ getProvider_e3d84eba_esm.e; }, "ChainMismatchError": function() { return /* reexport */ getProvider_e3d84eba_esm.b; }, "ChainNotConfiguredError": function() { return /* reexport */ getProvider_e3d84eba_esm.k; }, "Client": function() { return /* reexport */ getProvider_e3d84eba_esm.i; }, "Connector": function() { return /* reexport */ getProvider_e3d84eba_esm.j; }, "ConnectorAlreadyConnectedError": function() { return /* reexport */ getProvider_e3d84eba_esm.C; }, "ConnectorNotFoundError": function() { return /* reexport */ getProvider_e3d84eba_esm.a; }, "ContractMethodDoesNotExistError": function() { return /* reexport */ getProvider_e3d84eba_esm.c; }, "ContractMethodNoResultError": function() { return /* reexport */ getProvider_e3d84eba_esm.f; }, "InjectedConnector": function() { return /* reexport */ getProvider_e3d84eba_esm.I; }, "ProviderChainsNotFound": function() { return /* reexport */ getProvider_e3d84eba_esm.P; }, "ProviderRpcError": function() { return /* reexport */ getProvider_e3d84eba_esm.l; }, "ResourceUnavailableError": function() { return /* reexport */ getProvider_e3d84eba_esm.R; }, "RpcError": function() { return /* reexport */ getProvider_e3d84eba_esm.m; }, "SwitchChainError": function() { return /* reexport */ getProvider_e3d84eba_esm.o; }, "SwitchChainNotSupportedError": function() { return /* reexport */ getProvider_e3d84eba_esm.S; }, "UserRejectedRequestError": function() { return /* reexport */ getProvider_e3d84eba_esm.U; }, "alchemyRpcUrls": function() { return /* reexport */ rpcs_e837abf2_esm.a; }, "allChains": function() { return /* reexport */ chains_505e1070_esm.a; }, "chain": function() { return /* reexport */ chains_505e1070_esm.c; }, "chainId": function() { return /* reexport */ chains_505e1070_esm.b; }, "configureChains": function() { return /* binding */ configureChains; }, "connect": function() { return /* binding */ connect; }, "createClient": function() { return /* reexport */ getProvider_e3d84eba_esm.h; }, "createStorage": function() { return /* reexport */ getProvider_e3d84eba_esm.p; }, "deepEqual": function() { return /* binding */ deepEqual; }, "defaultChains": function() { return /* reexport */ chains_505e1070_esm.d; }, "defaultL2Chains": function() { return /* reexport */ chains_505e1070_esm.e; }, "deprecatedSendTransaction": function() { return /* binding */ deprecatedSendTransaction; }, "deprecatedWriteContract": function() { return /* binding */ deprecatedWriteContract; }, "disconnect": function() { return /* binding */ disconnect; }, "erc20ABI": function() { return /* binding */ erc20ABI; }, "erc721ABI": function() { return /* binding */ erc721ABI; }, "etherscanBlockExplorers": function() { return /* reexport */ chains_505e1070_esm.f; }, "fetchBalance": function() { return /* binding */ fetchBalance; }, "fetchBlockNumber": function() { return /* binding */ fetchBlockNumber; }, "fetchEnsAddress": function() { return /* binding */ fetchEnsAddress; }, "fetchEnsAvatar": function() { return /* binding */ fetchEnsAvatar; }, "fetchEnsName": function() { return /* binding */ fetchEnsName; }, "fetchEnsResolver": function() { return /* binding */ fetchEnsResolver; }, "fetchFeeData": function() { return /* binding */ fetchFeeData; }, "fetchSigner": function() { return /* binding */ fetchSigner; }, "fetchToken": function() { return /* binding */ fetchToken; }, "fetchTransaction": function() { return /* binding */ fetchTransaction; }, "getAccount": function() { return /* binding */ getAccount; }, "getContract": function() { return /* binding */ getContract; }, "getNetwork": function() { return /* binding */ getNetwork; }, "getProvider": function() { return /* reexport */ getProvider_e3d84eba_esm.d; }, "getWebSocketProvider": function() { return /* binding */ getWebSocketProvider; }, "infuraRpcUrls": function() { return /* reexport */ rpcs_e837abf2_esm.i; }, "noopStorage": function() { return /* reexport */ getProvider_e3d84eba_esm.q; }, "normalizeChainId": function() { return /* reexport */ getProvider_e3d84eba_esm.n; }, "parseContractResult": function() { return /* binding */ parseContractResult; }, "prepareSendTransaction": function() { return /* binding */ prepareSendTransaction; }, "prepareWriteContract": function() { return /* binding */ prepareWriteContract; }, "publicRpcUrls": function() { return /* reexport */ rpcs_e837abf2_esm.p; }, "readContract": function() { return /* binding */ readContract; }, "readContracts": function() { return /* binding */ readContracts; }, "sendTransaction": function() { return /* binding */ sendTransaction; }, "signMessage": function() { return /* binding */ signMessage; }, "signTypedData": function() { return /* binding */ signTypedData; }, "switchNetwork": function() { return /* binding */ switchNetwork; }, "units": function() { return /* binding */ units; }, "waitForTransaction": function() { return /* binding */ waitForTransaction; }, "watchAccount": function() { return /* binding */ watchAccount; }, "watchBlockNumber": function() { return /* binding */ watchBlockNumber; }, "watchContractEvent": function() { return /* binding */ watchContractEvent; }, "watchNetwork": function() { return /* binding */ watchNetwork; }, "watchProvider": function() { return /* binding */ watchProvider; }, "watchReadContract": function() { return /* binding */ watchReadContract; }, "watchReadContracts": function() { return /* binding */ watchReadContracts; }, "watchSigner": function() { return /* binding */ watchSigner; }, "watchWebSocketProvider": function() { return /* binding */ watchWebSocketProvider; }, "writeContract": function() { return /* binding */ writeContract; } }); // EXTERNAL MODULE: ./node_modules/@wagmi/core/dist/getProvider-e3d84eba.esm.js + 2 modules var getProvider_e3d84eba_esm = __webpack_require__(96093); // EXTERNAL MODULE: ./node_modules/@ethersproject/providers/lib.esm/fallback-provider.js var fallback_provider = __webpack_require__(51619); // EXTERNAL MODULE: ./node_modules/@ethersproject/contracts/lib.esm/index.js + 1 modules var lib_esm = __webpack_require__(64146); // EXTERNAL MODULE: ./node_modules/ethers/lib/ethers.js var ethers = __webpack_require__(5151); // EXTERNAL MODULE: ./node_modules/ethers/lib/utils.js var utils = __webpack_require__(56371); ;// CONCATENATED MODULE: ./node_modules/zustand/esm/shallow.js function shallow(objA, objB) { if (Object.is(objA, objB)) { return true; } if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null) { return false; } const keysA = Object.keys(objA); if (keysA.length !== Object.keys(objB).length) { return false; } for (let i = 0; i < keysA.length; i++) { if (!Object.prototype.hasOwnProperty.call(objB, keysA[i]) || !Object.is(objA[keysA[i]], objB[keysA[i]])) { return false; } } return true; } // EXTERNAL MODULE: ./node_modules/@wagmi/core/dist/rpcs-e837abf2.esm.js var rpcs_e837abf2_esm = __webpack_require__(87782); // EXTERNAL MODULE: ./node_modules/@wagmi/core/dist/chains-505e1070.esm.js var chains_505e1070_esm = __webpack_require__(98392); // EXTERNAL MODULE: ./node_modules/eventemitter3/index.js var eventemitter3 = __webpack_require__(26729); ;// CONCATENATED MODULE: ./node_modules/@wagmi/core/dist/wagmi-core.esm.js function configureChains(defaultChains, providers) { let { minQuorum = 1, pollingInterval = 4000, targetQuorum = 1, stallTimeout } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; if (!defaultChains.length) throw new Error('must have at least one chain'); if (targetQuorum < minQuorum) throw new Error('quorum cannot be lower than minQuorum'); let chains = []; const providers_ = {}; const webSocketProviders_ = {}; for (const chain of defaultChains) { let configExists = false; for (const provider of providers) { const apiConfig = provider(chain); // If no API configuration was found (ie. no RPC URL) for // this provider, then we skip and check the next one. if (!apiConfig) continue; configExists = true; if (!chains.some(_ref => { let { id } = _ref; return id === chain.id; })) { chains = [...chains, apiConfig.chain]; } providers_[chain.id] = [...(providers_[chain.id] || []), apiConfig.provider]; if (apiConfig.webSocketProvider) { webSocketProviders_[chain.id] = [...(webSocketProviders_[chain.id] || []), apiConfig.webSocketProvider]; } } // If no API configuration was found across the providers // then we throw an error to the consumer. if (!configExists) { throw new Error(["Could not find valid provider configuration for chain \"".concat(chain.name, "\".\n"), "You may need to add `jsonRpcProvider` to `configureChains` with the chain's RPC URLs.", 'Read more: https://wagmi.sh/docs/providers/jsonRpc'].join('\n')); } } return { chains, provider: _ref2 => { var _defaultChains$; let { chainId } = _ref2; const activeChainId = chainId && chains.some(x => x.id === chainId) ? chainId : (_defaultChains$ = defaultChains[0]) === null || _defaultChains$ === void 0 ? void 0 : _defaultChains$.id; const chainProviders = providers_[activeChainId]; if (!chainProviders || !chainProviders[0]) throw new Error("No providers configured for chain \"".concat(activeChainId, "\"")); if (chainProviders.length === 1) { return Object.assign(chainProviders[0](), { chains, pollingInterval }); } return Object.assign(fallbackProvider(targetQuorum, minQuorum, chainProviders, { stallTimeout }), { chains, pollingInterval }); }, webSocketProvider: _ref3 => { var _defaultChains$2, _chainWebSocketProvid; let { chainId } = _ref3; const activeChainId = chainId && chains.some(x => x.id === chainId) ? chainId : (_defaultChains$2 = defaultChains[0]) === null || _defaultChains$2 === void 0 ? void 0 : _defaultChains$2.id; const chainWebSocketProviders = webSocketProviders_[activeChainId]; if (!chainWebSocketProviders) return undefined; // WebSockets do not work with `fallbackProvider` // Default to first available return Object.assign(((_chainWebSocketProvid = chainWebSocketProviders[0]) === null || _chainWebSocketProvid === void 0 ? void 0 : _chainWebSocketProvid.call(chainWebSocketProviders)) || {}, { chains }); } }; } function fallbackProvider(targetQuorum, minQuorum, providers_, _ref4) { let { stallTimeout } = _ref4; try { return new fallback_provider/* FallbackProvider */.H(providers_.map((chainProvider, index) => { var _provider$priority, _provider$stallTimeou; const provider = chainProvider(); return { provider, priority: (_provider$priority = provider.priority) !== null && _provider$priority !== void 0 ? _provider$priority : index, stallTimeout: (_provider$stallTimeou = provider.stallTimeout) !== null && _provider$stallTimeou !== void 0 ? _provider$stallTimeou : stallTimeout, weight: provider.weight }; }), targetQuorum); } catch (error) { var _error$message; if (error !== null && error !== void 0 && (_error$message = error.message) !== null && _error$message !== void 0 && _error$message.includes('quorum will always fail; larger than total weight')) { if (targetQuorum === minQuorum) throw error; return fallbackProvider(targetQuorum - 1, minQuorum, providers_, { stallTimeout }); } throw error; } } /** Forked from https://github.com/epoberezkin/fast-deep-equal */ function deepEqual(a, b) { if (a === b) return true; if (a && b && typeof a === 'object' && typeof b === 'object') { if (a.constructor !== b.constructor) return false; let length; let i; if (Array.isArray(a) && Array.isArray(b)) { length = a.length; if (length != b.length) return false; for (i = length; i-- !== 0;) if (!deepEqual(a[i], b[i])) return false; return true; } if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); const keys = Object.keys(a); length = keys.length; if (length !== Object.keys(b).length) return false; for (i = length; i-- !== 0;) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; for (i = length; i-- !== 0;) { const key = keys[i]; if (key && !deepEqual(a[key], b[key])) return false; } return true; } // true if both NaN, false otherwise return a !== a && b !== b; } function isPlainArray(value) { return Array.isArray(value) && Object.keys(value).length === value.length; } function parseContractResult(_ref) { let { contractInterface, data, functionName } = _ref; if (data && isPlainArray(data)) { var _fragment$outputs; const iface = ethers.Contract.getInterface(contractInterface); const fragment = iface.getFunction(functionName); const isTuple = (((_fragment$outputs = fragment.outputs) === null || _fragment$outputs === void 0 ? void 0 : _fragment$outputs.length) || 0) > 1; const data_ = isTuple ? data : [data]; const encodedResult = iface.encodeFunctionResult(functionName, data_); const decodedResult = iface.decodeFunctionResult(functionName, encodedResult); return isTuple ? decodedResult : decodedResult[0]; } return data; } // https://ethereum.org/en/developers/docs/standards/tokens/erc-20 const erc20ABI = ['event Approval(address indexed _owner, address indexed _spender, uint256 _value)', 'event Transfer(address indexed _from, address indexed _to, uint256 _value)', 'function allowance(address _owner, address _spender) public view returns (uint256 remaining)', 'function approve(address _spender, uint256 _value) public returns (bool success)', 'function balanceOf(address _owner) public view returns (uint256 balance)', 'function decimals() public view returns (uint8)', 'function name() public view returns (string)', 'function symbol() public view returns (string)', 'function totalSupply() public view returns (uint256)', 'function transfer(address _to, uint256 _value) public returns (bool success)', 'function transferFrom(address _from, address _to, uint256 _value) public returns (bool success)']; // https://ethereum.org/en/developers/docs/standards/tokens/erc-721 const erc721ABI = ['event Approval(address indexed _owner, address indexed _approved, uint256 indexed _tokenId)', 'event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved)', 'event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId)', 'function approve(address _approved, uint256 _tokenId) external payable', 'function balanceOf(address _owner) external view returns (uint256)', 'function getApproved(uint256 _tokenId) external view returns (address)', 'function isApprovedForAll(address _owner, address _operator) external view returns (bool)', 'function name() view returns (string memory)', 'function ownerOf(uint256 _tokenId) external view returns (address)', 'function safeTransferFrom(address _from, address _to, uint256 _tokenId) external payable', 'function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes data) external payable', 'function setApprovalForAll(address _operator, bool _approved) external', 'function symbol() view returns (string memory)', 'function tokenByIndex(uint256 _index) view returns (uint256)', 'function tokenOfOwnerByIndex(address _owner, uint256 _index) view returns (uint256 tokenId)', 'function tokenURI(uint256 _tokenId) view returns (string memory)', 'function totalSupply() view returns (uint256)', 'function transferFrom(address _from, address _to, uint256 _tokenId) external payable']; const multicallInterface = [{ inputs: [{ components: [{ internalType: 'address', name: 'target', type: 'address' }, { internalType: 'bool', name: 'allowFailure', type: 'bool' }, { internalType: 'bytes', name: 'callData', type: 'bytes' }], internalType: 'struct Multicall3.Call3[]', name: 'calls', type: 'tuple[]' }], name: 'aggregate3', outputs: [{ components: [{ internalType: 'bool', name: 'success', type: 'bool' }, { internalType: 'bytes', name: 'returnData', type: 'bytes' }], internalType: 'struct Multicall3.Result[]', name: 'returnData', type: 'tuple[]' }], stateMutability: 'view', type: 'function' }]; // https://github.com/ethers-io/ethers.js/blob/master/packages/units/src.ts/index.ts#L10-L18 const units = ['wei', 'kwei', 'mwei', 'gwei', 'szabo', 'finney', 'ether']; async function connect(_ref) { let { chainId, connector } = _ref; const client = (0,getProvider_e3d84eba_esm.g)(); const activeConnector = client.connector; if (connector.id === (activeConnector === null || activeConnector === void 0 ? void 0 : activeConnector.id)) throw new getProvider_e3d84eba_esm.C(); try { client.setState(x => ({ ...x, status: 'connecting' })); const data = await connector.connect({ chainId }); client.setLastUsedConnector(connector.id); client.setState(x => ({ ...x, connector, chains: connector === null || connector === void 0 ? void 0 : connector.chains, data, status: 'connected' })); client.storage.setItem('connected', true); return { ...data, connector }; } catch (err) { client.setState(x => { return { ...x, // Keep existing connector connected in case of error status: x.connector ? 'connected' : 'disconnected' }; }); throw err; } } async function disconnect() { const client = (0,getProvider_e3d84eba_esm.g)(); if (client.connector) await client.connector.disconnect(); client.clearState(); client.storage.removeItem('connected'); } function getContract(_ref) { let { addressOrName, contractInterface, signerOrProvider } = _ref; return new lib_esm.Contract(addressOrName, contractInterface, signerOrProvider); } async function deprecatedWriteContract(_ref) { let { addressOrName, args, chainId, contractInterface, functionName, overrides, signerOrProvider } = _ref; const { connector } = (0,getProvider_e3d84eba_esm.g)(); if (!connector) throw new getProvider_e3d84eba_esm.a(); const params = [...(Array.isArray(args) ? args : args ? [args] : []), ...(overrides ? [overrides] : [])]; try { var _chain; let chain; if (chainId) { const activeChainId = await connector.getChainId(); // Try to switch chain to provided `chainId` if (chainId !== activeChainId) { var _connector$chains$fin, _connector$chains$fin2, _connector$chains$fin3, _connector$chains$fin4; if (connector.switchChain) chain = await connector.switchChain(chainId);else throw new getProvider_e3d84eba_esm.b({ activeChain: (_connector$chains$fin = (_connector$chains$fin2 = connector.chains.find(x => x.id === activeChainId)) === null || _connector$chains$fin2 === void 0 ? void 0 : _connector$chains$fin2.name) !== null && _connector$chains$fin !== void 0 ? _connector$chains$fin : "Chain ".concat(activeChainId), targetChain: (_connector$chains$fin3 = (_connector$chains$fin4 = connector.chains.find(x => x.id === chainId)) === null || _connector$chains$fin4 === void 0 ? void 0 : _connector$chains$fin4.name) !== null && _connector$chains$fin3 !== void 0 ? _connector$chains$fin3 : "Chain ".concat(chainId) }); } } const signer = await connector.getSigner({ chainId: (_chain = chain) === null || _chain === void 0 ? void 0 : _chain.id }); const contract = getContract({ addressOrName, contractInterface, signerOrProvider }); const contractWithSigner = contract.connect(signer); const contractFunction = contractWithSigner[functionName]; if (!contractFunction) console.warn("\"".concat(functionName, "\" does not exist in interface for contract \"").concat(addressOrName, "\"")); return await contractFunction(...params); } catch (error) { if (error.code === 4001) throw new getProvider_e3d84eba_esm.U(error); throw error; } } async function fetchToken(_ref) { let { address, chainId, formatUnits: units = 'ether' } = _ref; const erc20Config = { addressOrName: address, contractInterface: erc20ABI, chainId }; const [decimals, name, symbol, totalSupply] = await readContracts({ allowFailure: false, contracts: [{ ...erc20Config, functionName: 'decimals' }, { ...erc20Config, functionName: 'name' }, { ...erc20Config, functionName: 'symbol' }, { ...erc20Config, functionName: 'totalSupply' }] }); return { address, decimals, name, symbol, totalSupply: { formatted: (0,utils.formatUnits)(totalSupply, units), value: totalSupply } }; } /** * @description Prepares the parameters required for a contract write transaction. * * Returns config to be passed through to `writeContract`. * * @example * import { prepareWriteContract, writeContract } from '@wagmi/core' * * const config = await prepareWriteContract({ * addressOrName: '0x...', * contractInterface: wagmiAbi, * functionName: 'mint', * }) * const result = await writeContract(config) */ async function prepareWriteContract(_ref) { let { addressOrName, args, chainId, contractInterface, functionName, overrides, signer: signer_ } = _ref; const signer = signer_ !== null && signer_ !== void 0 ? signer_ : await fetchSigner(); if (!signer) throw new getProvider_e3d84eba_esm.a(); const contract = getContract({ addressOrName, contractInterface, signerOrProvider: signer }); const populateTransactionFn = contract.populateTransaction[functionName]; if (!populateTransactionFn) { throw new getProvider_e3d84eba_esm.c({ addressOrName, functionName }); } const params = [...(Array.isArray(args) ? args : args ? [args] : []), ...(overrides ? [overrides] : [])]; const unsignedTransaction = await populateTransactionFn(...params); const gasLimit = unsignedTransaction.gasLimit || (await signer.estimateGas(unsignedTransaction)); return { addressOrName, args, ...(chainId ? { chainId } : {}), contractInterface, functionName, overrides, request: { ...unsignedTransaction, gasLimit }, mode: 'prepared' }; } function getWebSocketProvider() { let { chainId } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; const client = (0,getProvider_e3d84eba_esm.g)(); if (chainId && typeof client.config.webSocketProvider === 'function') return client.config.webSocketProvider({ chainId }); return client.webSocketProvider; } function watchProvider(args, callback) { const client = (0,getProvider_e3d84eba_esm.g)(); const handleChange = async () => callback((0,getProvider_e3d84eba_esm.d)(args)); const unsubscribe = client.subscribe(_ref => { let { provider } = _ref; return provider; }, handleChange); return unsubscribe; } function watchWebSocketProvider(args, callback) { const client = (0,getProvider_e3d84eba_esm.g)(); const handleChange = async () => callback(getWebSocketProvider(args)); const unsubscribe = client.subscribe(_ref => { let { webSocketProvider } = _ref; return webSocketProvider; }, handleChange); return unsubscribe; } async function readContract(_ref) { let { addressOrName, args, chainId, contractInterface, functionName, overrides } = _ref; const provider = (0,getProvider_e3d84eba_esm.d)({ chainId }); const contract = getContract({ addressOrName, contractInterface, signerOrProvider: provider }); const params = [...(Array.isArray(args) ? args : args ? [args] : []), ...(overrides ? [overrides] : [])]; const contractFunction = contract[functionName]; if (!contractFunction) console.warn("\"".concat(functionName, "\" is not in the interface for contract \"").concat(addressOrName, "\"")); const response = await (contractFunction === null || contractFunction === void 0 ? void 0 : contractFunction(...params)); return response; } async function multicall(_ref) { let { allowFailure = true, chainId, contracts, overrides } = _ref; const provider = (0,getProvider_e3d84eba_esm.d)({ chainId }); if (!provider.chains) throw new getProvider_e3d84eba_esm.P(); const chain = provider.chains.find(chain => chain.id === chainId) || provider.chains[0]; if (!chain) throw new getProvider_e3d84eba_esm.P(); if (!(chain !== null && chain !== void 0 && chain.multicall)) throw new getProvider_e3d84eba_esm.e({ chain }); if (typeof (overrides === null || overrides === void 0 ? void 0 : overrides.blockTag) === 'number' && (overrides === null || overrides === void 0 ? void 0 : overrides.blockTag) < chain.multicall.blockCreated) throw new getProvider_e3d84eba_esm.e({ blockNumber: overrides === null || overrides === void 0 ? void 0 : overrides.blockTag, chain }); const multicallContract = getContract({ addressOrName: chain.multicall.address, contractInterface: multicallInterface, signerOrProvider: provider }); const calls = contracts.map(_ref2 => { let { addressOrName, contractInterface, functionName, ...config } = _ref2; const { args } = config || {}; const contract = getContract({ addressOrName, contractInterface }); const params = Array.isArray(args) ? args : args ? [args] : []; const callData = contract.interface.encodeFunctionData(functionName, params); if (!contract[functionName]) console.warn("\"".concat(functionName, "\" is not in the interface for contract \"").concat(addressOrName, "\"")); return { target: addressOrName, allowFailure, callData }; }); const params = [...[calls], ...(overrides ? [overrides] : [])]; const results = await multicallContract.aggregate3(...params); return results.map((_ref3, i) => { let { returnData, success } = _ref3; if (!success) return null; const { addressOrName, contractInterface, functionName } = contracts[i]; if (returnData === '0x') { const err = new getProvider_e3d84eba_esm.f({ addressOrName, chainId: chain.id, functionName }); if (!allowFailure) throw err; console.warn(err.message); return null; } const contract = getContract({ addressOrName, contractInterface }); try { const result = contract.interface.decodeFunctionResult(functionName, returnData); return Array.isArray(result) && result.length === 1 ? result[0] : result; } catch (err) { if (!allowFailure) throw err; return null; } }); } async function readContracts(_ref) { let { allowFailure = true, contracts, overrides } = _ref; try { const provider = (0,getProvider_e3d84eba_esm.d)(); const contractsByChainId = contracts.reduce((contracts, contract) => { var _contract$chainId; const chainId = (_contract$chainId = contract.chainId) !== null && _contract$chainId !== void 0 ? _contract$chainId : provider.network.chainId; return { ...contracts, [chainId]: [...(contracts[chainId] || []), contract] }; }, {}); const promises = Object.entries(contractsByChainId).map(_ref2 => { let [chainId, contracts] = _ref2; return multicall({ allowFailure, chainId: parseInt(chainId), contracts, overrides }); }); if (allowFailure) { return (await Promise.allSettled(promises)).map(result => { if (result.status === 'fulfilled') return result.value; if (result.reason instanceof getProvider_e3d84eba_esm.e) { console.warn(result.reason.message); throw result.reason; } return null; }).flat(); } return (await Promise.all(promises)).flat(); } catch (err) { if (err instanceof getProvider_e3d84eba_esm.f) throw err; const promises = contracts.map(contract => readContract({ ...contract, overrides })); if (allowFailure) { return (await Promise.allSettled(promises)).map(result => result.status === 'fulfilled' ? result.value : null); } return await Promise.all(promises); } } function watchContractEvent( /** Contract configuration */ contractArgs, /** Event name to listen to */ eventName, callback) { let { chainId, once } = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; let contract; const watchEvent = async () => { if (contract) { var _contract; (_contract = contract) === null || _contract === void 0 ? void 0 : _contract.off(eventName, callback); } contract = getContract({ signerOrProvider: getWebSocketProvider({ chainId }) || (0,getProvider_e3d84eba_esm.d)({ chainId }), ...contractArgs }); if (once) contract.once(eventName, callback);else contract.on(eventName, callback); }; watchEvent(); const client = (0,getProvider_e3d84eba_esm.g)(); const unsubscribe = client.subscribe(_ref => { let { provider, webSocketProvider } = _ref; return { provider, webSocketProvider }; }, watchEvent, { equalityFn: shallow }); return () => { var _contract2; (_contract2 = contract) === null || _contract2 === void 0 ? void 0 : _contract2.off(eventName, callback); unsubscribe(); }; } async function fetchBlockNumber() { let { chainId } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; const provider = (0,getProvider_e3d84eba_esm.d)({ chainId }); const blockNumber = await provider.getBlockNumber(); return blockNumber; } function watchBlockNumber(args, callback) { var _client$webSocketProv; let previousProvider; const createListener = provider => { if (previousProvider) { var _previousProvider; (_previousProvider = previousProvider) === null || _previousProvider === void 0 ? void 0 : _previousProvider.off('block', callback); } provider.on('block', callback); previousProvider = provider; }; const client = (0,getProvider_e3d84eba_esm.g)(); const provider_ = (_client$webSocketProv = client.webSocketProvider) !== null && _client$webSocketProv !== void 0 ? _client$webSocketProv : client.provider; if (args.listen) createListener(provider_); const unsubscribe = client.subscribe(_ref => { let { provider, webSocketProvider } = _ref; return { provider, webSocketProvider }; }, async _ref2 => { let { provider, webSocketProvider } = _ref2; const provider_ = webSocketProvider !== null && webSocketProvider !== void 0 ? webSocketProvider : provider; if (args.listen && provider_) { createListener(provider_); } callback(await fetchBlockNumber()); }, { equalityFn: shallow }); return () => { unsubscribe(); provider_ === null || provider_ === void 0 ? void 0 : provider_.off('block', callback); }; } function watchReadContract(config, callback) { const client = (0,getProvider_e3d84eba_esm.g)(); const handleChange = async () => callback(await readContract(config)); const unwatch = config.listenToBlock ? watchBlockNumber({ listen: true }, handleChange) : undefined; const unsubscribe = client.subscribe(_ref => { let { provider } = _ref; return provider; }, handleChange); return () => { unsubscribe(); unwatch === null || unwatch === void 0 ? void 0 : unwatch(); }; } function watchReadContracts(config, callback) { const client = (0,getProvider_e3d84eba_esm.g)(); const handleChange = async () => callback(await readContracts(config)); const unwatch = config.listenToBlock ? watchBlockNumber({ listen: true }, handleChange) : undefined; const unsubscribe = client.subscribe(_ref => { let { provider } = _ref; return provider; }, handleChange); return () => { unsubscribe(); unwatch === null || unwatch === void 0 ? void 0 : unwatch(); }; } async function deprecatedSendTransaction(_ref) { let { chainId, request } = _ref; const { connector } = (0,getProvider_e3d84eba_esm.g)(); if (!connector) throw new getProvider_e3d84eba_esm.a(); try { var _chain; let chain; if (chainId) { const activeChainId = await connector.getChainId(); // Try to switch chain to provided `chainId` if (chainId !== activeChainId) { var _connector$chains$fin, _connector$chains$fin2, _connector$chains$fin3, _connector$chains$fin4; if (connector.switchChain) chain = await connector.switchChain(chainId);else throw new getProvider_e3d84eba_esm.b({ activeChain: (_connector$chains$fin = (_connector$chains$fin2 = connector.chains.find(x => x.id === activeChainId)) === null || _connector$chains$fin2 === void 0 ? void 0 : _connector$chains$fin2.name) !== null && _connector$chains$fin !== void 0 ? _connector$chains$fin : "Chain ".concat(activeChainId), targetChain: (_connector$chains$fin3 = (_connector$chains$fin4 = connector.chains.find(x => x.id === chainId)) === null || _connector$chains$fin4 === void 0 ? void 0 : _connector$chains$fin4.name) !== null && _connector$chains$fin3 !== void 0 ? _connector$chains$fin3 : "Chain ".concat(chainId) }); } } const signer = await connector.getSigner({ chainId: (_chain = chain) === null || _chain === void 0 ? void 0 : _chain.id }); return await signer.sendTransaction(request); } catch (error) { if (error.code === 4001) throw new getProvider_e3d84eba_esm.U(error); throw error; } } /** * @description Fetches transaction for hash * * @example * import { fetchTransaction } from '@wagmi/core' * * const transaction = await fetchTransaction({ * chainId: 1, * hash: '0x...', * }) */ async function fetchTransaction(_ref) { let { chainId, hash } = _ref; const provider = (0,getProvider_e3d84eba_esm.d)({ chainId }); return await provider.getTransaction(hash); } async function fetchEnsAddress(_ref) { let { chainId, name } = _ref; const provider = (0,getProvider_e3d84eba_esm.d)({ chainId }); const address = await provider.resolveName(name); try { return address ? (0,utils.getAddress)(address) : null; } catch (_error) { return null; } } async function fetchEnsAvatar(_ref) { let { addressOrName, chainId } = _ref; const provider = (0,getProvider_e3d84eba_esm.d)({ chainId }); // TODO: Update with more advanced logic // https://github.com/ensdomains/ens-avatar const avatar = await provider.getAvatar(addressOrName); return avatar; } async function fetchEnsName(_ref) { let { address, chainId } = _ref; const provider = (0,getProvider_e3d84eba_esm.d)({ chainId }); return await provider.lookupAddress(address); } async function fetchEnsResolver(_ref) { let { chainId, name } = _ref; const provider = (0,getProvider_e3d84eba_esm.d)({ chainId }); const resolver = await provider.getResolver(name); return resolver; } /** * @description Prepares the parameters required for sending a transaction. * * Returns config to be passed through to `sendTransaction`. * * @example * import { prepareSendTransaction, sendTransaction } from '@wagmi/core' * * const config = await prepareSendTransaction({ * request: { * to: 'moxey.eth', * value: parseEther('1'), * } * }) * const result = await sendTransaction(config) */ async function prepareSendTransaction(_ref) { let { chainId, request, signerOrProvider = (0,getProvider_e3d84eba_esm.d)({ chainId }) } = _ref; const [to, gasLimit] = await Promise.all([(0,utils.isAddress)(request.to) ? Promise.resolve(request.to) : fetchEnsAddress({ name: request.to }), request.gasLimit ? Promise.resolve(request.gasLimit) : signerOrProvider.estimateGas(request)]); if (!to) throw new Error('Could not resolve ENS name'); return { ...(chainId ? { chainId } : {}), request: { ...request, gasLimit, to }, mode: 'prepared' }; } /** * @description Function to send a transaction. * * It is recommended to pair this with the `prepareSendTransaction` function to avoid * [UX pitfalls](https://wagmi.sh/docs/prepare-hooks/intro#ux-pitfalls-without-prepare-hooks). * * @example * import { prepareSendTransaction, sendTransaction } from '@wagmi/core' * * const config = await prepareSendTransaction({ * to: 'moxey.eth', * value: parseEther('1'), * }) * const result = await sendTransaction(config) */ async function sendTransaction(_ref) { let { chainId, mode, request } = _ref; /********************************************************************/ /** START: iOS App Link cautious code. */ /** Do not perform any async operations in this block. */ /** Ref: wagmi.sh/docs/prepare-hooks/intro#ios-app-link-constraints */ /********************************************************************/ // `fetchSigner` isn't really "asynchronous" as we have already // initialized the provider upon user connection, so it will return // immediately. const signer = await fetchSigner(); if (!signer) throw new getProvider_e3d84eba_esm.a(); if (mode === 'prepared') { if (!request.gasLimit) throw new Error('`gasLimit` is required'); if (!request.to) throw new Error('`to` is required'); } const { chain: activeChain, chains } = getNetwork(); const activeChainId = activeChain === null || activeChain === void 0 ? void 0 : activeChain.id; if (chainId && chainId !== (activeChain === null || activeChain === void 0 ? void 0 : activeChain.id)) { var _chains$find$name, _chains$find, _chains$find$name2, _chains$find2; throw new getProvider_e3d84eba_esm.b({ activeChain: (_chains$find$name = (_chains$find = chains.find(x => x.id === activeChainId)) === null || _chains$find === void 0 ? void 0 : _chains$find.name) !== null && _chains$find$name !== void 0 ? _chains$find$name : "Chain ".concat(activeChainId), targetChain: (_chains$find$name2 = (_chains$find2 = chains.find(x => x.id === chainId)) === null || _chains$find2 === void 0 ? void 0 : _chains$find2.name) !== null && _chains$find$name2 !== void 0 ? _chains$find$name2 : "Chain ".concat(chainId) }); } try { var _connectUnchecked, _ref2; // Why don't we just use `signer.sendTransaction`? // The `signer.sendTransaction` method performs async // heavy operations (such as fetching block number) // which is not really needed for our case. // Having async heavy operations has side effects // when using it in a click handler (iOS deep linking issues, // delay to open wallet, etc). const uncheckedSigner = (_connectUnchecked = (_ref2 = signer).connectUnchecked) === null || _connectUnchecked === void 0 ? void 0 : _connectUnchecked.call(_ref2); const { hash, wait } = await (uncheckedSigner !== null && uncheckedSigner !== void 0 ? uncheckedSigner : signer).sendTransaction(request); /********************************************************************/ /** END: iOS App Link cautious code. */ /** Go nuts! */ /********************************************************************/ return { hash, wait }; } catch (error) { if (error.code === 4001) throw new getProvider_e3d84eba_esm.U(error); throw error; } } async function waitForTransaction(_ref) { let { chainId, confirmations, hash, timeout, wait: wait_ } = _ref; let promise; if (hash) { const provider = (0,getProvider_e3d84eba_esm.d)({ chainId }); promise = provider.waitForTransaction(hash, confirmations, timeout); } else if (wait_) promise = wait_(confirmations);else throw new Error('hash or wait is required'); return await promise; } /** * @description Function to call a contract write method. * * It is recommended to pair this with the {@link prepareWriteContract} function * to avoid [UX pitfalls](https://wagmi.sh/docs/prepare-hooks/intro#ux-pitfalls-without-prepare-hooks). * * @example * import { prepareWriteContract, writeContract } from '@wagmi/core' * * const config = await prepareWriteContract({ * addressOrName: '0x...', * contractInterface: wagmiAbi, * functionName: 'mint', * }) * const result = await writeContract(config) */ async function writeContract(_ref) { let { addressOrName, args, chainId, contractInterface, functionName, mode, overrides, request: request_ } = _ref; /********************************************************************/ /** START: iOS App Link cautious code. */ /** Do not perform any async operations in this block. */ /** Ref: wagmi.sh/docs/prepare-hooks/intro#ios-app-link-constraints */ /********************************************************************/ const signer = await fetchSigner(); if (!signer) throw new getProvider_e3d84eba_esm.a(); const { chain: activeChain, chains } = getNetwork(); const activeChainId = activeChain === null || activeChain === void 0 ? void 0 : activeChain.id; if (chainId && chainId !== activeChainId) { var _chains$find$name, _chains$find, _chains$find$name2, _chains$find2; throw new getProvider_e3d84eba_esm.b({ activeChain: (_chains$find$name = (_chains$find = chains.find(x => x.id === activeChainId)) === null || _chains$find === void 0 ? void 0 : _chains$find.name) !== null && _chains$find$name !== void 0 ? _chains$find$name : "Chain ".concat(activeChainId), targetChain: (_chains$find$name2 = (_chains$find2 = chains.find(x => x.id === chainId)) === null || _chains$find2 === void 0 ? void 0 : _chains$find2.name) !== null && _chains$find$name2 !== void 0 ? _chains$find$name2 : "Chain ".concat(chainId) }); } if (mode === 'prepared') { if (!request_) throw new Error('`request` is required'); } const request = mode === 'recklesslyUnprepared' ? (await prepareWriteContract({ addressOrName, args, contractInterface, functionName, overrides })).request : request_; const transaction = await sendTransaction({ request, mode: 'prepared' }); /********************************************************************/ /** END: iOS App Link cautious code. */ /** Go nuts! */ /********************************************************************/ return transaction; } async function fetchBalance(_ref) { var _client$chains, _chain$nativeCurrency, _chain$nativeCurrency2, _chain$nativeCurrency3, _chain$nativeCurrency4; let { addressOrName, chainId, formatUnits: unit, token } = _ref; const client = (0,getProvider_e3d84eba_esm.g)(); const provider = (0,getProvider_e3d84eba_esm.d)({ chainId }); if (token) { const erc20Config = { addressOrName: token, contractInterface: erc20ABI, chainId }; // Convert ENS name to address if required let resolvedAddress; if ((0,utils.isAddress)(addressOrName)) resolvedAddress = addressOrName;else { const address = await provider.resolveName(addressOrName); // Same error `provider.getBalance` throws for invalid ENS name if (!address) ethers.logger.throwError('ENS name not configured', utils.Logger.errors.UNSUPPORTED_OPERATION, { operation: "resolveName(".concat(JSON.stringify(addressOrName), ")") }); resolvedAddress = address; } const [value, decimals, symbol] = await readContracts({ allowFailure: false, contracts: [{ ...erc20Config, functionName: 'balanceOf', args: resolvedAddress }, { ...erc20Config, functionName: 'decimals' }, { ...erc20Config, functionName: 'symbol' }] }); return { decimals, formatted: (0,utils.formatUnits)(value !== null && value !== void 0 ? value : '0', unit !== null && unit !== void 0 ? unit : decimals), symbol, value }; } const chains = [...(client.provider.chains || []), ...((_client$chains = client.chains) !== null && _client$chains !== void 0 ? _client$chains : [])]; const value = await provider.getBalance(addressOrName); const chain = chains.find(x => x.id === provider.network.chainId); return { decimals: (_chain$nativeCurrency = chain === null || chain === void 0 ? void 0 : (_chain$nativeCurrency2 = chain.nativeCurrency) === null || _chain$nativeCurrency2 === void 0 ? void 0 : _chain$nativeCurrency2.decimals) !== null && _chain$nativeCurrency !== void 0 ? _chain$nativeCurrency : 18, formatted: (0,utils.formatUnits)(value !== null && value !== void 0 ? value : '0', unit !== null && unit !== void 0 ? unit : 'ether'), symbol: (_chain$nativeCurrency3 = chain === null || chain === void 0 ? void 0 : (_chain$nativeCurrency4 = chain.nativeCurrency) === null || _chain$nativeCurrency4 === void 0 ? void 0 : _chain$nativeCurrency4.symbol) !== null && _chain$nativeCurrency3 !== void 0 ? _chain$nativeCurrency3 : 'ETH', value }; } async function fetchSigner() { var _client$connector, _client$connector$get; const client = (0,getProvider_e3d84eba_esm.g)(); const signer = (await ((_client$connector = client.connector) === null || _client$connector === void 0 ? void 0 : (_client$connector$get = _client$connector.getSigner) === null || _client$connector$get === void 0 ? void 0 : _client$connector$get.call(_client$connector))) || null; return signer; } function getAccount() { const { data, connector, status } = (0,getProvider_e3d84eba_esm.g)(); switch (status) { case 'connected': return { address: data === null || data === void 0 ? void 0 : data.account, connector: connector, isConnected: true, isConnecting: false, isDisconnected: false, isReconnecting: false, status }; case 'reconnecting': return { address: data === null || data === void 0 ? void 0 : data.account, connector, isConnected: !!(data !== null && data !== void 0 && data.account), isConnecting: false, isDisconnected: false, isReconnecting: true, status }; case 'connecting': return { address: undefined, connector: undefined, isConnected: false, isConnecting: true, isDisconnected: false, isReconnecting: false, status }; case 'disconnected': return { address: undefined, connector: undefined, isConnected: false, isConnecting: false, isDisconnected: true, isReconnecting: false, status }; } } function getNetwork() { var _client$data, _client$data$chain, _client$chains, _find, _client$data2; const client = (0,getProvider_e3d84eba_esm.g)(); const chainId = (_client$data = client.data) === null || _client$data === void 0 ? void 0 : (_client$data$chain = _client$data.chain) === null || _client$data$chain === void 0 ? void 0 : _client$data$chain.id; const activeChains = (_client$chains = client.chains) !== null && _client$chains !== void 0 ? _client$chains : []; const activeChain = (_find = [...(client.provider.chains || []), ...activeChains].find(x => x.id === chainId)) !== null && _find !== void 0 ? _find : { id: chainId, name: "Chain ".concat(chainId), network: "".concat(chainId), rpcUrls: { default: '' } }; return { chain: chainId ? { ...activeChain, ...((_client$data2 = client.data) === null || _client$data2 === void 0 ? void 0 : _client$data2.chain), id: chainId } : undefined, chains: activeChains }; } async function signMessage(args) { try { const signer = await fetchSigner(); if (!signer) throw new getProvider_e3d84eba_esm.a(); return await signer.signMessage(args.message); } catch (error) { if (error.code === 4001) throw new getProvider_e3d84eba_esm.U(error); throw error; } } async function signTypedData(_ref) { let { domain, types, value } = _ref; const signer = await fetchSigner(); if (!signer) throw new getProvider_e3d84eba_esm.a(); const { chain: activeChain, chains } = getNetwork(); const { chainId: chainId_ } = domain; if (chainId_) { const chainId = (0,getProvider_e3d84eba_esm.n)(chainId_); const activeChainId = activeChain === null || activeChain === void 0 ? void 0 : activeChain.id; if (chainId !== (activeChain === null || activeChain === void 0 ? void 0 : activeChain.id)) { var _chains$find$name, _chains$find, _chains$find$name2, _chains$find2; throw new getProvider_e3d84eba_esm.b({ activeChain: (_chains$find$name = (_chains$find = chains.find(x => x.id === activeChainId)) === null || _chains$find === void 0 ? void 0 : _chains$find.name) !== null && _chains$find$name !== void 0 ? _chains$find$name : "Chain ".concat(activeChainId), targetChain: (_chains$find$name2 = (_chains$find2 = chains.find(x => x.id === chainId)) === null || _chains$find2 === void 0 ? void 0 : _chains$find2.name) !== null && _chains$find$name2 !== void 0 ? _chains$find$name2 : "Chain ".concat(chainId) }); } } // Method name may be changed in the future, see https://docs.ethers.io/v5/api/signer/#Signer-signTypedData return await signer._signTypedData(domain, types, value); } async function switchNetwork(_ref) { let { chainId } = _ref; const { connector } = (0,getProvider_e3d84eba_esm.g)(); if (!connector) throw new getProvider_e3d84eba_esm.a(); if (!connector.switchChain) throw new getProvider_e3d84eba_esm.S({ connector }); return await connector.switchChain(chainId); } function watchAccount(callback) { let { selector = x => x } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; const client = (0,getProvider_e3d84eba_esm.g)(); const handleChange = () => callback(getAccount()); const unsubscribe = client.subscribe(_ref => { let { data, connector, status } = _ref; return selector({ address: data === null || data === void 0 ? void 0 : data.account, connector, status }); }, handleChange, { equalityFn: shallow }); return unsubscribe; } function watchNetwork(callback) { let { selector = x => x } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; const client = (0,getProvider_e3d84eba_esm.g)(); const handleChange = () => callback(getNetwork()); const unsubscribe = client.subscribe(_ref => { var _data$chain; let { data, chains } = _ref; return selector({ chainId: data === null || data === void 0 ? void 0 : (_data$chain = data.chain) === null || _data$chain === void 0 ? void 0 : _data$chain.id, chains }); }, handleChange, { equalityFn: shallow }); return unsubscribe; } function watchSigner(callback) { const client = (0,getProvider_e3d84eba_esm.g)(); const handleChange = async () => callback(await fetchSigner()); const unsubscribe = client.subscribe(_ref => { var _data$chain; let { data, connector } = _ref; return { account: data === null || data === void 0 ? void 0 : data.account, chainId: data === null || data === void 0 ? void 0 : (_data$chain = data.chain) === null || _data$chain === void 0 ? void 0 : _data$chain.id, connector }; }, handleChange, { equalityFn: shallow }); return unsubscribe; } async function fetchFeeData() { let { chainId, formatUnits: units = 'wei' } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; const provider = (0,getProvider_e3d84eba_esm.d)({ chainId }); const feeData = await provider.getFeeData(); const formatted = { gasPrice: feeData.gasPrice ? (0,utils.formatUnits)(feeData.gasPrice, units) : null, maxFeePerGas: feeData.maxFeePerGas ? (0,utils.formatUnits)(feeData.maxFeePerGas, units) : null, maxPriorityFeePerGas: feeData.maxPriorityFeePerGas ? (0,utils.formatUnits)(feeData.maxPriorityFeePerGas, units) : null }; return { ...feeData, formatted }; } /***/ }), /***/ 52707: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "A7": function() { return /* binding */ isHexString; }, /* harmony export */ "KT": function() { return /* binding */ removeHexPrefix; }, /* harmony export */ "L_": function() { return /* binding */ addHexPrefix; }, /* harmony export */ "OG": function() { return /* binding */ utf8ToHex; }, /* harmony export */ "QM": function() { return /* binding */ arrayToBuffer; }, /* harmony export */ "ZV": function() { return /* binding */ utf8ToArray; }, /* harmony export */ "Zr": function() { return /* binding */ utf8ToBuffer; }, /* harmony export */ "_W": function() { return /* binding */ bufferToArray; }, /* harmony export */ "ek": function() { return /* binding */ arrayToHex; }, /* harmony export */ "eu": function() { return /* binding */ hexToArray; }, /* harmony export */ "oO": function() { return /* binding */ arrayToUtf8; }, /* harmony export */ "w3": function() { return /* binding */ concatArrays; }, /* harmony export */ "wL": function() { return /* binding */ removeHexLeadingZeros; }, /* harmony export */ "xb": function() { return /* binding */ sanitizeHex; } /* harmony export */ }); /* unused harmony exports bufferToHex, bufferToUtf8, bufferToNumber, bufferToBinary, arrayToNumber, arrayToBinary, hexToBuffer, hexToUtf8, hexToNumber, hexToBinary, utf8ToNumber, utf8ToBinary, numberToBuffer, numberToArray, numberToHex, numberToUtf8, numberToBinary, binaryToBuffer, binaryToArray, binaryToHex, binaryToUtf8, binaryToNumber, isBinaryString, isBuffer, isTypedArray, isArrayBuffer, getType, getEncoding, concatBuffers, trimLeft, trimRight, calcByteLength, splitBytes, swapBytes, swapHex, sanitizeBytes, padLeft, padRight */ /* harmony import */ var is_typedarray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4501); /* harmony import */ var is_typedarray__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(is_typedarray__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var typedarray_to_buffer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(65054); /* harmony import */ var typedarray_to_buffer__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(typedarray_to_buffer__WEBPACK_IMPORTED_MODULE_1__); /* provided dependency */ var Buffer = __webpack_require__(48764)["Buffer"]; const ENC_HEX = "hex"; const ENC_UTF8 = "utf8"; const ENC_BIN = "binary"; const TYPE_BUFFER = "buffer"; const TYPE_ARRAY = "array"; const TYPE_TYPED_ARRAY = "typed-array"; const TYPE_ARRAY_BUFFER = "array-buffer"; const STRING_ZERO = "0"; function bufferToArray(buf) { return new Uint8Array(buf); } function bufferToHex(buf, prefixed = false) { const hex = buf.toString(ENC_HEX); return prefixed ? addHexPrefix(hex) : hex; } function bufferToUtf8(buf) { return buf.toString(ENC_UTF8); } function bufferToNumber(buf) { return buf.readUIntBE(0, buf.length); } function bufferToBinary(buf) { return arrayToBinary(bufferToArray(buf)); } function arrayToBuffer(arr) { return typedarray_to_buffer__WEBPACK_IMPORTED_MODULE_1___default()(arr); } function arrayToHex(arr, prefixed = false) { return bufferToHex(arrayToBuffer(arr), prefixed); } function arrayToUtf8(arr) { return bufferToUtf8(arrayToBuffer(arr)); } function arrayToNumber(arr) { return bufferToNumber(arrayToBuffer(arr)); } function arrayToBinary(arr) { return Array.from(arr) .map(numberToBinary) .join(""); } function hexToBuffer(hex) { return Buffer.from(removeHexPrefix(hex), ENC_HEX); } function hexToArray(hex) { return bufferToArray(hexToBuffer(hex)); } function hexToUtf8(hex) { return bufferToUtf8(hexToBuffer(hex)); } function hexToNumber(hex) { return arrayToNumber(hexToArray(hex)); } function hexToBinary(hex) { return arrayToBinary(hexToArray(hex)); } function utf8ToBuffer(utf8) { return Buffer.from(utf8, ENC_UTF8); } function utf8ToArray(utf8) { return bufferToArray(utf8ToBuffer(utf8)); } function utf8ToHex(utf8, prefixed = false) { return bufferToHex(utf8ToBuffer(utf8), prefixed); } function utf8ToNumber(utf8) { const num = parseInt(utf8, 10); assert(isDefined(num), "Number can only safely store up to 53 bits"); return num; } function utf8ToBinary(utf8) { return arrayToBinary(utf8ToArray(utf8)); } function numberToBuffer(num) { return binaryToBuffer(numberToBinary(num)); } function numberToArray(num) { return binaryToArray(numberToBinary(num)); } function numberToHex(num, prefixed) { return binaryToHex(numberToBinary(num), prefixed); } function numberToUtf8(num) { return `${num}`; } function numberToBinary(num) { const bin = (num >>> 0).toString(2); return sanitizeBytes(bin); } function binaryToBuffer(bin) { return arrayToBuffer(binaryToArray(bin)); } function binaryToArray(bin) { return new Uint8Array(splitBytes(bin).map(x => parseInt(x, 2))); } function binaryToHex(bin, prefixed) { return arrayToHex(binaryToArray(bin), prefixed); } function binaryToUtf8(bin) { return arrayToUtf8(binaryToArray(bin)); } function binaryToNumber(bin) { return arrayToNumber(binaryToArray(bin)); } function isBinaryString(str) { if (typeof str !== "string" || !new RegExp(/^[01]+$/).test(str)) { return false; } if (str.length % 8 !== 0) { return false; } return true; } function isHexString(str, length) { if (typeof str !== "string" || !str.match(/^0x[0-9A-Fa-f]*$/)) { return false; } if (length && str.length !== 2 + 2 * length) { return false; } return true; } function isBuffer(val) { return Buffer.isBuffer(val); } function isTypedArray(val) { return _isTypedArray.strict(val) && !isBuffer(val); } function isArrayBuffer(val) { return (!isTypedArray(val) && !isBuffer(val) && typeof val.byteLength !== "undefined"); } function getType(val) { if (isBuffer(val)) { return TYPE_BUFFER; } else if (isTypedArray(val)) { return TYPE_TYPED_ARRAY; } else if (isArrayBuffer(val)) { return TYPE_ARRAY_BUFFER; } else if (Array.isArray(val)) { return TYPE_ARRAY; } else { return typeof val; } } function getEncoding(str) { if (isBinaryString(str)) { return ENC_BIN; } if (isHexString(str)) { return ENC_HEX; } return ENC_UTF8; } function concatBuffers(...args) { const result = Buffer.concat(args); return result; } function concatArrays(...args) { let result = []; args.forEach(arg => (result = result.concat(Array.from(arg)))); return new Uint8Array([...result]); } function trimLeft(data, length) { const diff = data.length - length; if (diff > 0) { data = data.slice(diff); } return data; } function trimRight(data, length) { return data.slice(0, length); } function calcByteLength(length, byteSize = 8) { const remainder = length % byteSize; return remainder ? ((length - remainder) / byteSize) * byteSize + byteSize : length; } function splitBytes(str, byteSize = 8) { const bytes = sanitizeBytes(str).match(new RegExp(`.{${byteSize}}`, "gi")); return Array.from(bytes || []); } function swapBytes(str) { return splitBytes(str) .map(reverseString) .join(""); } function swapHex(str) { return binaryToHex(swapBytes(hexToBinary(str))); } function sanitizeBytes(str, byteSize = 8, padding = STRING_ZERO) { return padLeft(str, calcByteLength(str.length, byteSize), padding); } function padLeft(str, length, padding = STRING_ZERO) { return padString(str, length, true, padding); } function padRight(str, length, padding = STRING_ZERO) { return padString(str, length, false, padding); } function removeHexPrefix(hex) { return hex.replace(/^0x/, ""); } function addHexPrefix(hex) { return hex.startsWith("0x") ? hex : `0x${hex}`; } function sanitizeHex(hex) { hex = removeHexPrefix(hex); hex = sanitizeBytes(hex, 2); if (hex) { hex = addHexPrefix(hex); } return hex; } function removeHexLeadingZeros(hex) { const prefixed = hex.startsWith("0x"); hex = removeHexPrefix(hex); hex = hex.startsWith(STRING_ZERO) ? hex.substring(1) : hex; return prefixed ? addHexPrefix(hex) : hex; } function isUndefined(value) { return typeof value === "undefined"; } function isDefined(value) { return !isUndefined(value); } function assert(assertion, errorMessage) { if (!assertion) { throw new Error(errorMessage); } } function reverseString(str) { return str .split("") .reverse() .join(""); } function padString(str, length, left, padding = STRING_ZERO) { const diff = length - str.length; let result = str; if (diff > 0) { const pad = padding.repeat(diff); result = left ? pad + str : str + pad; } return result; } //# sourceMappingURL=index.js.map /***/ }), /***/ 62873: /***/ (function(__unused_webpack_module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getLocalStorage = exports.getLocalStorageOrThrow = exports.getCrypto = exports.getCryptoOrThrow = exports.getLocation = exports.getLocationOrThrow = exports.getNavigator = exports.getNavigatorOrThrow = exports.getDocument = exports.getDocumentOrThrow = exports.getFromWindowOrThrow = exports.getFromWindow = void 0; function getFromWindow(name) { let res = undefined; if (typeof window !== "undefined" && typeof window[name] !== "undefined") { res = window[name]; } return res; } exports.getFromWindow = getFromWindow; function getFromWindowOrThrow(name) { const res = getFromWindow(name); if (!res) { throw new Error(`${name} is not defined in Window`); } return res; } exports.getFromWindowOrThrow = getFromWindowOrThrow; function getDocumentOrThrow() { return getFromWindowOrThrow("document"); } exports.getDocumentOrThrow = getDocumentOrThrow; function getDocument() { return getFromWindow("document"); } exports.getDocument = getDocument; function getNavigatorOrThrow() { return getFromWindowOrThrow("navigator"); } exports.getNavigatorOrThrow = getNavigatorOrThrow; function getNavigator() { return getFromWindow("navigator"); } exports.getNavigator = getNavigator; function getLocationOrThrow() { return getFromWindowOrThrow("location"); } exports.getLocationOrThrow = getLocationOrThrow; function getLocation() { return getFromWindow("location"); } exports.getLocation = getLocation; function getCryptoOrThrow() { return getFromWindowOrThrow("crypto"); } exports.getCryptoOrThrow = getCryptoOrThrow; function getCrypto() { return getFromWindow("crypto"); } exports.getCrypto = getCrypto; function getLocalStorageOrThrow() { return getFromWindowOrThrow("localStorage"); } exports.getLocalStorageOrThrow = getLocalStorageOrThrow; function getLocalStorage() { return getFromWindow("localStorage"); } exports.getLocalStorage = getLocalStorage; //# sourceMappingURL=index.js.map /***/ }), /***/ 78826: /***/ (function(module) { "use strict"; (function(root) { function checkInt(value) { return (parseInt(value) === value); } function checkInts(arrayish) { if (!checkInt(arrayish.length)) { return false; } for (var i = 0; i < arrayish.length; i++) { if (!checkInt(arrayish[i]) || arrayish[i] < 0 || arrayish[i] > 255) { return false; } } return true; } function coerceArray(arg, copy) { // ArrayBuffer view if (arg.buffer && ArrayBuffer.isView(arg) && arg.name === 'Uint8Array') { if (copy) { if (arg.slice) { arg = arg.slice(); } else { arg = Array.prototype.slice.call(arg); } } return arg; } // It's an array; check it is a valid representation of a byte if (Array.isArray(arg)) { if (!checkInts(arg)) { throw new Error('Array contains invalid value: ' + arg); } return new Uint8Array(arg); } // Something else, but behaves like an array (maybe a Buffer? Arguments?) if (checkInt(arg.length) && checkInts(arg)) { return new Uint8Array(arg); } throw new Error('unsupported array-like object'); } function createArray(length) { return new Uint8Array(length); } function copyArray(sourceArray, targetArray, targetStart, sourceStart, sourceEnd) { if (sourceStart != null || sourceEnd != null) { if (sourceArray.slice) { sourceArray = sourceArray.slice(sourceStart, sourceEnd); } else { sourceArray = Array.prototype.slice.call(sourceArray, sourceStart, sourceEnd); } } targetArray.set(sourceArray, targetStart); } var convertUtf8 = (function() { function toBytes(text) { var result = [], i = 0; text = encodeURI(text); while (i < text.length) { var c = text.charCodeAt(i++); // if it is a % sign, encode the following 2 bytes as a hex value if (c === 37) { result.push(parseInt(text.substr(i, 2), 16)) i += 2; // otherwise, just the actual byte } else { result.push(c) } } return coerceArray(result); } function fromBytes(bytes) { var result = [], i = 0; while (i < bytes.length) { var c = bytes[i]; if (c < 128) { result.push(String.fromCharCode(c)); i++; } else if (c > 191 && c < 224) { result.push(String.fromCharCode(((c & 0x1f) << 6) | (bytes[i + 1] & 0x3f))); i += 2; } else { result.push(String.fromCharCode(((c & 0x0f) << 12) | ((bytes[i + 1] & 0x3f) << 6) | (bytes[i + 2] & 0x3f))); i += 3; } } return result.join(''); } return { toBytes: toBytes, fromBytes: fromBytes, } })(); var convertHex = (function() { function toBytes(text) { var result = []; for (var i = 0; i < text.length; i += 2) { result.push(parseInt(text.substr(i, 2), 16)); } return result; } // http://ixti.net/development/javascript/2011/11/11/base64-encodedecode-of-utf8-in-browser-with-js.html var Hex = '0123456789abcdef'; function fromBytes(bytes) { var result = []; for (var i = 0; i < bytes.length; i++) { var v = bytes[i]; result.push(Hex[(v & 0xf0) >> 4] + Hex[v & 0x0f]); } return result.join(''); } return { toBytes: toBytes, fromBytes: fromBytes, } })(); // Number of rounds by keysize var numberOfRounds = {16: 10, 24: 12, 32: 14} // Round constant words var rcon = [0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91]; // S-box and Inverse S-box (S is for Substitution) var S = [0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16]; var Si =[0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d]; // Transformations for encryption var T1 = [0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d, 0xfff2f20d, 0xd66b6bbd, 0xde6f6fb1, 0x91c5c554, 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d, 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a, 0x8fcaca45, 0x1f82829d, 0x89c9c940, 0xfa7d7d87, 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b, 0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea, 0x239c9cbf, 0x53a4a4f7, 0xe4727296, 0x9bc0c05b, 0x75b7b7c2, 0xe1fdfd1c, 0x3d9393ae, 0x4c26266a, 0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f, 0x6834345c, 0x51a5a5f4, 0xd1e5e534, 0xf9f1f108, 0xe2717193, 0xabd8d873, 0x62313153, 0x2a15153f, 0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e, 0x30181828, 0x379696a1, 0x0a05050f, 0x2f9a9ab5, 0x0e070709, 0x24121236, 0x1b80809b, 0xdfe2e23d, 0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f, 0x1209091b, 0x1d83839e, 0x582c2c74, 0x341a1a2e, 0x361b1b2d, 0xdc6e6eb2, 0xb45a5aee, 0x5ba0a0fb, 0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce, 0x5229297b, 0xdde3e33e, 0x5e2f2f71, 0x13848497, 0xa65353f5, 0xb9d1d168, 0x00000000, 0xc1eded2c, 0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed, 0xd46a6abe, 0x8dcbcb46, 0x67bebed9, 0x7239394b, 0x944a4ade, 0x984c4cd4, 0xb05858e8, 0x85cfcf4a, 0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16, 0x864343c5, 0x9a4d4dd7, 0x66333355, 0x11858594, 0x8a4545cf, 0xe9f9f910, 0x04020206, 0xfe7f7f81, 0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3, 0xa25151f3, 0x5da3a3fe, 0x804040c0, 0x058f8f8a, 0x3f9292ad, 0x219d9dbc, 0x70383848, 0xf1f5f504, 0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163, 0x20101030, 0xe5ffff1a, 0xfdf3f30e, 0xbfd2d26d, 0x81cdcd4c, 0x180c0c14, 0x26131335, 0xc3ecec2f, 0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739, 0x93c4c457, 0x55a7a7f2, 0xfc7e7e82, 0x7a3d3d47, 0xc86464ac, 0xba5d5de7, 0x3219192b, 0xe6737395, 0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f, 0x44222266, 0x542a2a7e, 0x3b9090ab, 0x0b888883, 0x8c4646ca, 0xc7eeee29, 0x6bb8b8d3, 0x2814143c, 0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76, 0xdbe0e03b, 0x64323256, 0x743a3a4e, 0x140a0a1e, 0x924949db, 0x0c06060a, 0x4824246c, 0xb85c5ce4, 0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6, 0x399191a8, 0x319595a4, 0xd3e4e437, 0xf279798b, 0xd5e7e732, 0x8bc8c843, 0x6e373759, 0xda6d6db7, 0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0, 0xd86c6cb4, 0xac5656fa, 0xf3f4f407, 0xcfeaea25, 0xca6565af, 0xf47a7a8e, 0x47aeaee9, 0x10080818, 0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72, 0x381c1c24, 0x57a6a6f1, 0x73b4b4c7, 0x97c6c651, 0xcbe8e823, 0xa1dddd7c, 0xe874749c, 0x3e1f1f21, 0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85, 0xe0707090, 0x7c3e3e42, 0x71b5b5c4, 0xcc6666aa, 0x904848d8, 0x06030305, 0xf7f6f601, 0x1c0e0e12, 0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0, 0x17868691, 0x99c1c158, 0x3a1d1d27, 0x279e9eb9, 0xd9e1e138, 0xebf8f813, 0x2b9898b3, 0x22111133, 0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7, 0x2d9b9bb6, 0x3c1e1e22, 0x15878792, 0xc9e9e920, 0x87cece49, 0xaa5555ff, 0x50282878, 0xa5dfdf7a, 0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17, 0x65bfbfda, 0xd7e6e631, 0x844242c6, 0xd06868b8, 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11, 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a]; var T2 = [0xa5c66363, 0x84f87c7c, 0x99ee7777, 0x8df67b7b, 0x0dfff2f2, 0xbdd66b6b, 0xb1de6f6f, 0x5491c5c5, 0x50603030, 0x03020101, 0xa9ce6767, 0x7d562b2b, 0x19e7fefe, 0x62b5d7d7, 0xe64dabab, 0x9aec7676, 0x458fcaca, 0x9d1f8282, 0x4089c9c9, 0x87fa7d7d, 0x15effafa, 0xebb25959, 0xc98e4747, 0x0bfbf0f0, 0xec41adad, 0x67b3d4d4, 0xfd5fa2a2, 0xea45afaf, 0xbf239c9c, 0xf753a4a4, 0x96e47272, 0x5b9bc0c0, 0xc275b7b7, 0x1ce1fdfd, 0xae3d9393, 0x6a4c2626, 0x5a6c3636, 0x417e3f3f, 0x02f5f7f7, 0x4f83cccc, 0x5c683434, 0xf451a5a5, 0x34d1e5e5, 0x08f9f1f1, 0x93e27171, 0x73abd8d8, 0x53623131, 0x3f2a1515, 0x0c080404, 0x5295c7c7, 0x65462323, 0x5e9dc3c3, 0x28301818, 0xa1379696, 0x0f0a0505, 0xb52f9a9a, 0x090e0707, 0x36241212, 0x9b1b8080, 0x3ddfe2e2, 0x26cdebeb, 0x694e2727, 0xcd7fb2b2, 0x9fea7575, 0x1b120909, 0x9e1d8383, 0x74582c2c, 0x2e341a1a, 0x2d361b1b, 0xb2dc6e6e, 0xeeb45a5a, 0xfb5ba0a0, 0xf6a45252, 0x4d763b3b, 0x61b7d6d6, 0xce7db3b3, 0x7b522929, 0x3edde3e3, 0x715e2f2f, 0x97138484, 0xf5a65353, 0x68b9d1d1, 0x00000000, 0x2cc1eded, 0x60402020, 0x1fe3fcfc, 0xc879b1b1, 0xedb65b5b, 0xbed46a6a, 0x468dcbcb, 0xd967bebe, 0x4b723939, 0xde944a4a, 0xd4984c4c, 0xe8b05858, 0x4a85cfcf, 0x6bbbd0d0, 0x2ac5efef, 0xe54faaaa, 0x16edfbfb, 0xc5864343, 0xd79a4d4d, 0x55663333, 0x94118585, 0xcf8a4545, 0x10e9f9f9, 0x06040202, 0x81fe7f7f, 0xf0a05050, 0x44783c3c, 0xba259f9f, 0xe34ba8a8, 0xf3a25151, 0xfe5da3a3, 0xc0804040, 0x8a058f8f, 0xad3f9292, 0xbc219d9d, 0x48703838, 0x04f1f5f5, 0xdf63bcbc, 0xc177b6b6, 0x75afdada, 0x63422121, 0x30201010, 0x1ae5ffff, 0x0efdf3f3, 0x6dbfd2d2, 0x4c81cdcd, 0x14180c0c, 0x35261313, 0x2fc3ecec, 0xe1be5f5f, 0xa2359797, 0xcc884444, 0x392e1717, 0x5793c4c4, 0xf255a7a7, 0x82fc7e7e, 0x477a3d3d, 0xacc86464, 0xe7ba5d5d, 0x2b321919, 0x95e67373, 0xa0c06060, 0x98198181, 0xd19e4f4f, 0x7fa3dcdc, 0x66442222, 0x7e542a2a, 0xab3b9090, 0x830b8888, 0xca8c4646, 0x29c7eeee, 0xd36bb8b8, 0x3c281414, 0x79a7dede, 0xe2bc5e5e, 0x1d160b0b, 0x76addbdb, 0x3bdbe0e0, 0x56643232, 0x4e743a3a, 0x1e140a0a, 0xdb924949, 0x0a0c0606, 0x6c482424, 0xe4b85c5c, 0x5d9fc2c2, 0x6ebdd3d3, 0xef43acac, 0xa6c46262, 0xa8399191, 0xa4319595, 0x37d3e4e4, 0x8bf27979, 0x32d5e7e7, 0x438bc8c8, 0x596e3737, 0xb7da6d6d, 0x8c018d8d, 0x64b1d5d5, 0xd29c4e4e, 0xe049a9a9, 0xb4d86c6c, 0xfaac5656, 0x07f3f4f4, 0x25cfeaea, 0xafca6565, 0x8ef47a7a, 0xe947aeae, 0x18100808, 0xd56fbaba, 0x88f07878, 0x6f4a2525, 0x725c2e2e, 0x24381c1c, 0xf157a6a6, 0xc773b4b4, 0x5197c6c6, 0x23cbe8e8, 0x7ca1dddd, 0x9ce87474, 0x213e1f1f, 0xdd964b4b, 0xdc61bdbd, 0x860d8b8b, 0x850f8a8a, 0x90e07070, 0x427c3e3e, 0xc471b5b5, 0xaacc6666, 0xd8904848, 0x05060303, 0x01f7f6f6, 0x121c0e0e, 0xa3c26161, 0x5f6a3535, 0xf9ae5757, 0xd069b9b9, 0x91178686, 0x5899c1c1, 0x273a1d1d, 0xb9279e9e, 0x38d9e1e1, 0x13ebf8f8, 0xb32b9898, 0x33221111, 0xbbd26969, 0x70a9d9d9, 0x89078e8e, 0xa7339494, 0xb62d9b9b, 0x223c1e1e, 0x92158787, 0x20c9e9e9, 0x4987cece, 0xffaa5555, 0x78502828, 0x7aa5dfdf, 0x8f038c8c, 0xf859a1a1, 0x80098989, 0x171a0d0d, 0xda65bfbf, 0x31d7e6e6, 0xc6844242, 0xb8d06868, 0xc3824141, 0xb0299999, 0x775a2d2d, 0x111e0f0f, 0xcb7bb0b0, 0xfca85454, 0xd66dbbbb, 0x3a2c1616]; var T3 = [0x63a5c663, 0x7c84f87c, 0x7799ee77, 0x7b8df67b, 0xf20dfff2, 0x6bbdd66b, 0x6fb1de6f, 0xc55491c5, 0x30506030, 0x01030201, 0x67a9ce67, 0x2b7d562b, 0xfe19e7fe, 0xd762b5d7, 0xabe64dab, 0x769aec76, 0xca458fca, 0x829d1f82, 0xc94089c9, 0x7d87fa7d, 0xfa15effa, 0x59ebb259, 0x47c98e47, 0xf00bfbf0, 0xadec41ad, 0xd467b3d4, 0xa2fd5fa2, 0xafea45af, 0x9cbf239c, 0xa4f753a4, 0x7296e472, 0xc05b9bc0, 0xb7c275b7, 0xfd1ce1fd, 0x93ae3d93, 0x266a4c26, 0x365a6c36, 0x3f417e3f, 0xf702f5f7, 0xcc4f83cc, 0x345c6834, 0xa5f451a5, 0xe534d1e5, 0xf108f9f1, 0x7193e271, 0xd873abd8, 0x31536231, 0x153f2a15, 0x040c0804, 0xc75295c7, 0x23654623, 0xc35e9dc3, 0x18283018, 0x96a13796, 0x050f0a05, 0x9ab52f9a, 0x07090e07, 0x12362412, 0x809b1b80, 0xe23ddfe2, 0xeb26cdeb, 0x27694e27, 0xb2cd7fb2, 0x759fea75, 0x091b1209, 0x839e1d83, 0x2c74582c, 0x1a2e341a, 0x1b2d361b, 0x6eb2dc6e, 0x5aeeb45a, 0xa0fb5ba0, 0x52f6a452, 0x3b4d763b, 0xd661b7d6, 0xb3ce7db3, 0x297b5229, 0xe33edde3, 0x2f715e2f, 0x84971384, 0x53f5a653, 0xd168b9d1, 0x00000000, 0xed2cc1ed, 0x20604020, 0xfc1fe3fc, 0xb1c879b1, 0x5bedb65b, 0x6abed46a, 0xcb468dcb, 0xbed967be, 0x394b7239, 0x4ade944a, 0x4cd4984c, 0x58e8b058, 0xcf4a85cf, 0xd06bbbd0, 0xef2ac5ef, 0xaae54faa, 0xfb16edfb, 0x43c58643, 0x4dd79a4d, 0x33556633, 0x85941185, 0x45cf8a45, 0xf910e9f9, 0x02060402, 0x7f81fe7f, 0x50f0a050, 0x3c44783c, 0x9fba259f, 0xa8e34ba8, 0x51f3a251, 0xa3fe5da3, 0x40c08040, 0x8f8a058f, 0x92ad3f92, 0x9dbc219d, 0x38487038, 0xf504f1f5, 0xbcdf63bc, 0xb6c177b6, 0xda75afda, 0x21634221, 0x10302010, 0xff1ae5ff, 0xf30efdf3, 0xd26dbfd2, 0xcd4c81cd, 0x0c14180c, 0x13352613, 0xec2fc3ec, 0x5fe1be5f, 0x97a23597, 0x44cc8844, 0x17392e17, 0xc45793c4, 0xa7f255a7, 0x7e82fc7e, 0x3d477a3d, 0x64acc864, 0x5de7ba5d, 0x192b3219, 0x7395e673, 0x60a0c060, 0x81981981, 0x4fd19e4f, 0xdc7fa3dc, 0x22664422, 0x2a7e542a, 0x90ab3b90, 0x88830b88, 0x46ca8c46, 0xee29c7ee, 0xb8d36bb8, 0x143c2814, 0xde79a7de, 0x5ee2bc5e, 0x0b1d160b, 0xdb76addb, 0xe03bdbe0, 0x32566432, 0x3a4e743a, 0x0a1e140a, 0x49db9249, 0x060a0c06, 0x246c4824, 0x5ce4b85c, 0xc25d9fc2, 0xd36ebdd3, 0xacef43ac, 0x62a6c462, 0x91a83991, 0x95a43195, 0xe437d3e4, 0x798bf279, 0xe732d5e7, 0xc8438bc8, 0x37596e37, 0x6db7da6d, 0x8d8c018d, 0xd564b1d5, 0x4ed29c4e, 0xa9e049a9, 0x6cb4d86c, 0x56faac56, 0xf407f3f4, 0xea25cfea, 0x65afca65, 0x7a8ef47a, 0xaee947ae, 0x08181008, 0xbad56fba, 0x7888f078, 0x256f4a25, 0x2e725c2e, 0x1c24381c, 0xa6f157a6, 0xb4c773b4, 0xc65197c6, 0xe823cbe8, 0xdd7ca1dd, 0x749ce874, 0x1f213e1f, 0x4bdd964b, 0xbddc61bd, 0x8b860d8b, 0x8a850f8a, 0x7090e070, 0x3e427c3e, 0xb5c471b5, 0x66aacc66, 0x48d89048, 0x03050603, 0xf601f7f6, 0x0e121c0e, 0x61a3c261, 0x355f6a35, 0x57f9ae57, 0xb9d069b9, 0x86911786, 0xc15899c1, 0x1d273a1d, 0x9eb9279e, 0xe138d9e1, 0xf813ebf8, 0x98b32b98, 0x11332211, 0x69bbd269, 0xd970a9d9, 0x8e89078e, 0x94a73394, 0x9bb62d9b, 0x1e223c1e, 0x87921587, 0xe920c9e9, 0xce4987ce, 0x55ffaa55, 0x28785028, 0xdf7aa5df, 0x8c8f038c, 0xa1f859a1, 0x89800989, 0x0d171a0d, 0xbfda65bf, 0xe631d7e6, 0x42c68442, 0x68b8d068, 0x41c38241, 0x99b02999, 0x2d775a2d, 0x0f111e0f, 0xb0cb7bb0, 0x54fca854, 0xbbd66dbb, 0x163a2c16]; var T4 = [0x6363a5c6, 0x7c7c84f8, 0x777799ee, 0x7b7b8df6, 0xf2f20dff, 0x6b6bbdd6, 0x6f6fb1de, 0xc5c55491, 0x30305060, 0x01010302, 0x6767a9ce, 0x2b2b7d56, 0xfefe19e7, 0xd7d762b5, 0xababe64d, 0x76769aec, 0xcaca458f, 0x82829d1f, 0xc9c94089, 0x7d7d87fa, 0xfafa15ef, 0x5959ebb2, 0x4747c98e, 0xf0f00bfb, 0xadadec41, 0xd4d467b3, 0xa2a2fd5f, 0xafafea45, 0x9c9cbf23, 0xa4a4f753, 0x727296e4, 0xc0c05b9b, 0xb7b7c275, 0xfdfd1ce1, 0x9393ae3d, 0x26266a4c, 0x36365a6c, 0x3f3f417e, 0xf7f702f5, 0xcccc4f83, 0x34345c68, 0xa5a5f451, 0xe5e534d1, 0xf1f108f9, 0x717193e2, 0xd8d873ab, 0x31315362, 0x15153f2a, 0x04040c08, 0xc7c75295, 0x23236546, 0xc3c35e9d, 0x18182830, 0x9696a137, 0x05050f0a, 0x9a9ab52f, 0x0707090e, 0x12123624, 0x80809b1b, 0xe2e23ddf, 0xebeb26cd, 0x2727694e, 0xb2b2cd7f, 0x75759fea, 0x09091b12, 0x83839e1d, 0x2c2c7458, 0x1a1a2e34, 0x1b1b2d36, 0x6e6eb2dc, 0x5a5aeeb4, 0xa0a0fb5b, 0x5252f6a4, 0x3b3b4d76, 0xd6d661b7, 0xb3b3ce7d, 0x29297b52, 0xe3e33edd, 0x2f2f715e, 0x84849713, 0x5353f5a6, 0xd1d168b9, 0x00000000, 0xeded2cc1, 0x20206040, 0xfcfc1fe3, 0xb1b1c879, 0x5b5bedb6, 0x6a6abed4, 0xcbcb468d, 0xbebed967, 0x39394b72, 0x4a4ade94, 0x4c4cd498, 0x5858e8b0, 0xcfcf4a85, 0xd0d06bbb, 0xefef2ac5, 0xaaaae54f, 0xfbfb16ed, 0x4343c586, 0x4d4dd79a, 0x33335566, 0x85859411, 0x4545cf8a, 0xf9f910e9, 0x02020604, 0x7f7f81fe, 0x5050f0a0, 0x3c3c4478, 0x9f9fba25, 0xa8a8e34b, 0x5151f3a2, 0xa3a3fe5d, 0x4040c080, 0x8f8f8a05, 0x9292ad3f, 0x9d9dbc21, 0x38384870, 0xf5f504f1, 0xbcbcdf63, 0xb6b6c177, 0xdada75af, 0x21216342, 0x10103020, 0xffff1ae5, 0xf3f30efd, 0xd2d26dbf, 0xcdcd4c81, 0x0c0c1418, 0x13133526, 0xecec2fc3, 0x5f5fe1be, 0x9797a235, 0x4444cc88, 0x1717392e, 0xc4c45793, 0xa7a7f255, 0x7e7e82fc, 0x3d3d477a, 0x6464acc8, 0x5d5de7ba, 0x19192b32, 0x737395e6, 0x6060a0c0, 0x81819819, 0x4f4fd19e, 0xdcdc7fa3, 0x22226644, 0x2a2a7e54, 0x9090ab3b, 0x8888830b, 0x4646ca8c, 0xeeee29c7, 0xb8b8d36b, 0x14143c28, 0xdede79a7, 0x5e5ee2bc, 0x0b0b1d16, 0xdbdb76ad, 0xe0e03bdb, 0x32325664, 0x3a3a4e74, 0x0a0a1e14, 0x4949db92, 0x06060a0c, 0x24246c48, 0x5c5ce4b8, 0xc2c25d9f, 0xd3d36ebd, 0xacacef43, 0x6262a6c4, 0x9191a839, 0x9595a431, 0xe4e437d3, 0x79798bf2, 0xe7e732d5, 0xc8c8438b, 0x3737596e, 0x6d6db7da, 0x8d8d8c01, 0xd5d564b1, 0x4e4ed29c, 0xa9a9e049, 0x6c6cb4d8, 0x5656faac, 0xf4f407f3, 0xeaea25cf, 0x6565afca, 0x7a7a8ef4, 0xaeaee947, 0x08081810, 0xbabad56f, 0x787888f0, 0x25256f4a, 0x2e2e725c, 0x1c1c2438, 0xa6a6f157, 0xb4b4c773, 0xc6c65197, 0xe8e823cb, 0xdddd7ca1, 0x74749ce8, 0x1f1f213e, 0x4b4bdd96, 0xbdbddc61, 0x8b8b860d, 0x8a8a850f, 0x707090e0, 0x3e3e427c, 0xb5b5c471, 0x6666aacc, 0x4848d890, 0x03030506, 0xf6f601f7, 0x0e0e121c, 0x6161a3c2, 0x35355f6a, 0x5757f9ae, 0xb9b9d069, 0x86869117, 0xc1c15899, 0x1d1d273a, 0x9e9eb927, 0xe1e138d9, 0xf8f813eb, 0x9898b32b, 0x11113322, 0x6969bbd2, 0xd9d970a9, 0x8e8e8907, 0x9494a733, 0x9b9bb62d, 0x1e1e223c, 0x87879215, 0xe9e920c9, 0xcece4987, 0x5555ffaa, 0x28287850, 0xdfdf7aa5, 0x8c8c8f03, 0xa1a1f859, 0x89898009, 0x0d0d171a, 0xbfbfda65, 0xe6e631d7, 0x4242c684, 0x6868b8d0, 0x4141c382, 0x9999b029, 0x2d2d775a, 0x0f0f111e, 0xb0b0cb7b, 0x5454fca8, 0xbbbbd66d, 0x16163a2c]; // Transformations for decryption var T5 = [0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96, 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393, 0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25, 0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f, 0xdeb15a49, 0x25ba1b67, 0x45ea0e98, 0x5dfec0e1, 0xc32f7502, 0x814cf012, 0x8d4697a3, 0x6bd3f9c6, 0x038f5fe7, 0x15929c95, 0xbf6d7aeb, 0x955259da, 0xd4be832d, 0x587421d3, 0x49e06929, 0x8ec9c844, 0x75c2896a, 0xf48e7978, 0x99583e6b, 0x27b971dd, 0xbee14fb6, 0xf088ad17, 0xc920ac66, 0x7dce3ab4, 0x63df4a18, 0xe51a3182, 0x97513360, 0x62537f45, 0xb16477e0, 0xbb6bae84, 0xfe81a01c, 0xf9082b94, 0x70486858, 0x8f45fd19, 0x94de6c87, 0x527bf8b7, 0xab73d323, 0x724b02e2, 0xe31f8f57, 0x6655ab2a, 0xb2eb2807, 0x2fb5c203, 0x86c57b9a, 0xd33708a5, 0x302887f2, 0x23bfa5b2, 0x02036aba, 0xed16825c, 0x8acf1c2b, 0xa779b492, 0xf307f2f0, 0x4e69e2a1, 0x65daf4cd, 0x0605bed5, 0xd134621f, 0xc4a6fe8a, 0x342e539d, 0xa2f355a0, 0x058ae132, 0xa4f6eb75, 0x0b83ec39, 0x4060efaa, 0x5e719f06, 0xbd6e1051, 0x3e218af9, 0x96dd063d, 0xdd3e05ae, 0x4de6bd46, 0x91548db5, 0x71c45d05, 0x0406d46f, 0x605015ff, 0x1998fb24, 0xd6bde997, 0x894043cc, 0x67d99e77, 0xb0e842bd, 0x07898b88, 0xe7195b38, 0x79c8eedb, 0xa17c0a47, 0x7c420fe9, 0xf8841ec9, 0x00000000, 0x09808683, 0x322bed48, 0x1e1170ac, 0x6c5a724e, 0xfd0efffb, 0x0f853856, 0x3daed51e, 0x362d3927, 0x0a0fd964, 0x685ca621, 0x9b5b54d1, 0x24362e3a, 0x0c0a67b1, 0x9357e70f, 0xb4ee96d2, 0x1b9b919e, 0x80c0c54f, 0x61dc20a2, 0x5a774b69, 0x1c121a16, 0xe293ba0a, 0xc0a02ae5, 0x3c22e043, 0x121b171d, 0x0e090d0b, 0xf28bc7ad, 0x2db6a8b9, 0x141ea9c8, 0x57f11985, 0xaf75074c, 0xee99ddbb, 0xa37f60fd, 0xf701269f, 0x5c72f5bc, 0x44663bc5, 0x5bfb7e34, 0x8b432976, 0xcb23c6dc, 0xb6edfc68, 0xb8e4f163, 0xd731dcca, 0x42638510, 0x13972240, 0x84c61120, 0x854a247d, 0xd2bb3df8, 0xaef93211, 0xc729a16d, 0x1d9e2f4b, 0xdcb230f3, 0x0d8652ec, 0x77c1e3d0, 0x2bb3166c, 0xa970b999, 0x119448fa, 0x47e96422, 0xa8fc8cc4, 0xa0f03f1a, 0x567d2cd8, 0x223390ef, 0x87494ec7, 0xd938d1c1, 0x8ccaa2fe, 0x98d40b36, 0xa6f581cf, 0xa57ade28, 0xdab78e26, 0x3fadbfa4, 0x2c3a9de4, 0x5078920d, 0x6a5fcc9b, 0x547e4662, 0xf68d13c2, 0x90d8b8e8, 0x2e39f75e, 0x82c3aff5, 0x9f5d80be, 0x69d0937c, 0x6fd52da9, 0xcf2512b3, 0xc8ac993b, 0x10187da7, 0xe89c636e, 0xdb3bbb7b, 0xcd267809, 0x6e5918f4, 0xec9ab701, 0x834f9aa8, 0xe6956e65, 0xaaffe67e, 0x21bccf08, 0xef15e8e6, 0xbae79bd9, 0x4a6f36ce, 0xea9f09d4, 0x29b07cd6, 0x31a4b2af, 0x2a3f2331, 0xc6a59430, 0x35a266c0, 0x744ebc37, 0xfc82caa6, 0xe090d0b0, 0x33a7d815, 0xf104984a, 0x41ecdaf7, 0x7fcd500e, 0x1791f62f, 0x764dd68d, 0x43efb04d, 0xccaa4d54, 0xe49604df, 0x9ed1b5e3, 0x4c6a881b, 0xc12c1fb8, 0x4665517f, 0x9d5eea04, 0x018c355d, 0xfa877473, 0xfb0b412e, 0xb3671d5a, 0x92dbd252, 0xe9105633, 0x6dd64713, 0x9ad7618c, 0x37a10c7a, 0x59f8148e, 0xeb133c89, 0xcea927ee, 0xb761c935, 0xe11ce5ed, 0x7a47b13c, 0x9cd2df59, 0x55f2733f, 0x1814ce79, 0x73c737bf, 0x53f7cdea, 0x5ffdaa5b, 0xdf3d6f14, 0x7844db86, 0xcaaff381, 0xb968c43e, 0x3824342c, 0xc2a3405f, 0x161dc372, 0xbce2250c, 0x283c498b, 0xff0d9541, 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190, 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742]; var T6 = [0x5051f4a7, 0x537e4165, 0xc31a17a4, 0x963a275e, 0xcb3bab6b, 0xf11f9d45, 0xabacfa58, 0x934be303, 0x552030fa, 0xf6ad766d, 0x9188cc76, 0x25f5024c, 0xfc4fe5d7, 0xd7c52acb, 0x80263544, 0x8fb562a3, 0x49deb15a, 0x6725ba1b, 0x9845ea0e, 0xe15dfec0, 0x02c32f75, 0x12814cf0, 0xa38d4697, 0xc66bd3f9, 0xe7038f5f, 0x9515929c, 0xebbf6d7a, 0xda955259, 0x2dd4be83, 0xd3587421, 0x2949e069, 0x448ec9c8, 0x6a75c289, 0x78f48e79, 0x6b99583e, 0xdd27b971, 0xb6bee14f, 0x17f088ad, 0x66c920ac, 0xb47dce3a, 0x1863df4a, 0x82e51a31, 0x60975133, 0x4562537f, 0xe0b16477, 0x84bb6bae, 0x1cfe81a0, 0x94f9082b, 0x58704868, 0x198f45fd, 0x8794de6c, 0xb7527bf8, 0x23ab73d3, 0xe2724b02, 0x57e31f8f, 0x2a6655ab, 0x07b2eb28, 0x032fb5c2, 0x9a86c57b, 0xa5d33708, 0xf2302887, 0xb223bfa5, 0xba02036a, 0x5ced1682, 0x2b8acf1c, 0x92a779b4, 0xf0f307f2, 0xa14e69e2, 0xcd65daf4, 0xd50605be, 0x1fd13462, 0x8ac4a6fe, 0x9d342e53, 0xa0a2f355, 0x32058ae1, 0x75a4f6eb, 0x390b83ec, 0xaa4060ef, 0x065e719f, 0x51bd6e10, 0xf93e218a, 0x3d96dd06, 0xaedd3e05, 0x464de6bd, 0xb591548d, 0x0571c45d, 0x6f0406d4, 0xff605015, 0x241998fb, 0x97d6bde9, 0xcc894043, 0x7767d99e, 0xbdb0e842, 0x8807898b, 0x38e7195b, 0xdb79c8ee, 0x47a17c0a, 0xe97c420f, 0xc9f8841e, 0x00000000, 0x83098086, 0x48322bed, 0xac1e1170, 0x4e6c5a72, 0xfbfd0eff, 0x560f8538, 0x1e3daed5, 0x27362d39, 0x640a0fd9, 0x21685ca6, 0xd19b5b54, 0x3a24362e, 0xb10c0a67, 0x0f9357e7, 0xd2b4ee96, 0x9e1b9b91, 0x4f80c0c5, 0xa261dc20, 0x695a774b, 0x161c121a, 0x0ae293ba, 0xe5c0a02a, 0x433c22e0, 0x1d121b17, 0x0b0e090d, 0xadf28bc7, 0xb92db6a8, 0xc8141ea9, 0x8557f119, 0x4caf7507, 0xbbee99dd, 0xfda37f60, 0x9ff70126, 0xbc5c72f5, 0xc544663b, 0x345bfb7e, 0x768b4329, 0xdccb23c6, 0x68b6edfc, 0x63b8e4f1, 0xcad731dc, 0x10426385, 0x40139722, 0x2084c611, 0x7d854a24, 0xf8d2bb3d, 0x11aef932, 0x6dc729a1, 0x4b1d9e2f, 0xf3dcb230, 0xec0d8652, 0xd077c1e3, 0x6c2bb316, 0x99a970b9, 0xfa119448, 0x2247e964, 0xc4a8fc8c, 0x1aa0f03f, 0xd8567d2c, 0xef223390, 0xc787494e, 0xc1d938d1, 0xfe8ccaa2, 0x3698d40b, 0xcfa6f581, 0x28a57ade, 0x26dab78e, 0xa43fadbf, 0xe42c3a9d, 0x0d507892, 0x9b6a5fcc, 0x62547e46, 0xc2f68d13, 0xe890d8b8, 0x5e2e39f7, 0xf582c3af, 0xbe9f5d80, 0x7c69d093, 0xa96fd52d, 0xb3cf2512, 0x3bc8ac99, 0xa710187d, 0x6ee89c63, 0x7bdb3bbb, 0x09cd2678, 0xf46e5918, 0x01ec9ab7, 0xa8834f9a, 0x65e6956e, 0x7eaaffe6, 0x0821bccf, 0xe6ef15e8, 0xd9bae79b, 0xce4a6f36, 0xd4ea9f09, 0xd629b07c, 0xaf31a4b2, 0x312a3f23, 0x30c6a594, 0xc035a266, 0x37744ebc, 0xa6fc82ca, 0xb0e090d0, 0x1533a7d8, 0x4af10498, 0xf741ecda, 0x0e7fcd50, 0x2f1791f6, 0x8d764dd6, 0x4d43efb0, 0x54ccaa4d, 0xdfe49604, 0xe39ed1b5, 0x1b4c6a88, 0xb8c12c1f, 0x7f466551, 0x049d5eea, 0x5d018c35, 0x73fa8774, 0x2efb0b41, 0x5ab3671d, 0x5292dbd2, 0x33e91056, 0x136dd647, 0x8c9ad761, 0x7a37a10c, 0x8e59f814, 0x89eb133c, 0xeecea927, 0x35b761c9, 0xede11ce5, 0x3c7a47b1, 0x599cd2df, 0x3f55f273, 0x791814ce, 0xbf73c737, 0xea53f7cd, 0x5b5ffdaa, 0x14df3d6f, 0x867844db, 0x81caaff3, 0x3eb968c4, 0x2c382434, 0x5fc2a340, 0x72161dc3, 0x0cbce225, 0x8b283c49, 0x41ff0d95, 0x7139a801, 0xde080cb3, 0x9cd8b4e4, 0x906456c1, 0x617bcb84, 0x70d532b6, 0x74486c5c, 0x42d0b857]; var T7 = [0xa75051f4, 0x65537e41, 0xa4c31a17, 0x5e963a27, 0x6bcb3bab, 0x45f11f9d, 0x58abacfa, 0x03934be3, 0xfa552030, 0x6df6ad76, 0x769188cc, 0x4c25f502, 0xd7fc4fe5, 0xcbd7c52a, 0x44802635, 0xa38fb562, 0x5a49deb1, 0x1b6725ba, 0x0e9845ea, 0xc0e15dfe, 0x7502c32f, 0xf012814c, 0x97a38d46, 0xf9c66bd3, 0x5fe7038f, 0x9c951592, 0x7aebbf6d, 0x59da9552, 0x832dd4be, 0x21d35874, 0x692949e0, 0xc8448ec9, 0x896a75c2, 0x7978f48e, 0x3e6b9958, 0x71dd27b9, 0x4fb6bee1, 0xad17f088, 0xac66c920, 0x3ab47dce, 0x4a1863df, 0x3182e51a, 0x33609751, 0x7f456253, 0x77e0b164, 0xae84bb6b, 0xa01cfe81, 0x2b94f908, 0x68587048, 0xfd198f45, 0x6c8794de, 0xf8b7527b, 0xd323ab73, 0x02e2724b, 0x8f57e31f, 0xab2a6655, 0x2807b2eb, 0xc2032fb5, 0x7b9a86c5, 0x08a5d337, 0x87f23028, 0xa5b223bf, 0x6aba0203, 0x825ced16, 0x1c2b8acf, 0xb492a779, 0xf2f0f307, 0xe2a14e69, 0xf4cd65da, 0xbed50605, 0x621fd134, 0xfe8ac4a6, 0x539d342e, 0x55a0a2f3, 0xe132058a, 0xeb75a4f6, 0xec390b83, 0xefaa4060, 0x9f065e71, 0x1051bd6e, 0x8af93e21, 0x063d96dd, 0x05aedd3e, 0xbd464de6, 0x8db59154, 0x5d0571c4, 0xd46f0406, 0x15ff6050, 0xfb241998, 0xe997d6bd, 0x43cc8940, 0x9e7767d9, 0x42bdb0e8, 0x8b880789, 0x5b38e719, 0xeedb79c8, 0x0a47a17c, 0x0fe97c42, 0x1ec9f884, 0x00000000, 0x86830980, 0xed48322b, 0x70ac1e11, 0x724e6c5a, 0xfffbfd0e, 0x38560f85, 0xd51e3dae, 0x3927362d, 0xd9640a0f, 0xa621685c, 0x54d19b5b, 0x2e3a2436, 0x67b10c0a, 0xe70f9357, 0x96d2b4ee, 0x919e1b9b, 0xc54f80c0, 0x20a261dc, 0x4b695a77, 0x1a161c12, 0xba0ae293, 0x2ae5c0a0, 0xe0433c22, 0x171d121b, 0x0d0b0e09, 0xc7adf28b, 0xa8b92db6, 0xa9c8141e, 0x198557f1, 0x074caf75, 0xddbbee99, 0x60fda37f, 0x269ff701, 0xf5bc5c72, 0x3bc54466, 0x7e345bfb, 0x29768b43, 0xc6dccb23, 0xfc68b6ed, 0xf163b8e4, 0xdccad731, 0x85104263, 0x22401397, 0x112084c6, 0x247d854a, 0x3df8d2bb, 0x3211aef9, 0xa16dc729, 0x2f4b1d9e, 0x30f3dcb2, 0x52ec0d86, 0xe3d077c1, 0x166c2bb3, 0xb999a970, 0x48fa1194, 0x642247e9, 0x8cc4a8fc, 0x3f1aa0f0, 0x2cd8567d, 0x90ef2233, 0x4ec78749, 0xd1c1d938, 0xa2fe8cca, 0x0b3698d4, 0x81cfa6f5, 0xde28a57a, 0x8e26dab7, 0xbfa43fad, 0x9de42c3a, 0x920d5078, 0xcc9b6a5f, 0x4662547e, 0x13c2f68d, 0xb8e890d8, 0xf75e2e39, 0xaff582c3, 0x80be9f5d, 0x937c69d0, 0x2da96fd5, 0x12b3cf25, 0x993bc8ac, 0x7da71018, 0x636ee89c, 0xbb7bdb3b, 0x7809cd26, 0x18f46e59, 0xb701ec9a, 0x9aa8834f, 0x6e65e695, 0xe67eaaff, 0xcf0821bc, 0xe8e6ef15, 0x9bd9bae7, 0x36ce4a6f, 0x09d4ea9f, 0x7cd629b0, 0xb2af31a4, 0x23312a3f, 0x9430c6a5, 0x66c035a2, 0xbc37744e, 0xcaa6fc82, 0xd0b0e090, 0xd81533a7, 0x984af104, 0xdaf741ec, 0x500e7fcd, 0xf62f1791, 0xd68d764d, 0xb04d43ef, 0x4d54ccaa, 0x04dfe496, 0xb5e39ed1, 0x881b4c6a, 0x1fb8c12c, 0x517f4665, 0xea049d5e, 0x355d018c, 0x7473fa87, 0x412efb0b, 0x1d5ab367, 0xd25292db, 0x5633e910, 0x47136dd6, 0x618c9ad7, 0x0c7a37a1, 0x148e59f8, 0x3c89eb13, 0x27eecea9, 0xc935b761, 0xe5ede11c, 0xb13c7a47, 0xdf599cd2, 0x733f55f2, 0xce791814, 0x37bf73c7, 0xcdea53f7, 0xaa5b5ffd, 0x6f14df3d, 0xdb867844, 0xf381caaf, 0xc43eb968, 0x342c3824, 0x405fc2a3, 0xc372161d, 0x250cbce2, 0x498b283c, 0x9541ff0d, 0x017139a8, 0xb3de080c, 0xe49cd8b4, 0xc1906456, 0x84617bcb, 0xb670d532, 0x5c74486c, 0x5742d0b8]; var T8 = [0xf4a75051, 0x4165537e, 0x17a4c31a, 0x275e963a, 0xab6bcb3b, 0x9d45f11f, 0xfa58abac, 0xe303934b, 0x30fa5520, 0x766df6ad, 0xcc769188, 0x024c25f5, 0xe5d7fc4f, 0x2acbd7c5, 0x35448026, 0x62a38fb5, 0xb15a49de, 0xba1b6725, 0xea0e9845, 0xfec0e15d, 0x2f7502c3, 0x4cf01281, 0x4697a38d, 0xd3f9c66b, 0x8f5fe703, 0x929c9515, 0x6d7aebbf, 0x5259da95, 0xbe832dd4, 0x7421d358, 0xe0692949, 0xc9c8448e, 0xc2896a75, 0x8e7978f4, 0x583e6b99, 0xb971dd27, 0xe14fb6be, 0x88ad17f0, 0x20ac66c9, 0xce3ab47d, 0xdf4a1863, 0x1a3182e5, 0x51336097, 0x537f4562, 0x6477e0b1, 0x6bae84bb, 0x81a01cfe, 0x082b94f9, 0x48685870, 0x45fd198f, 0xde6c8794, 0x7bf8b752, 0x73d323ab, 0x4b02e272, 0x1f8f57e3, 0x55ab2a66, 0xeb2807b2, 0xb5c2032f, 0xc57b9a86, 0x3708a5d3, 0x2887f230, 0xbfa5b223, 0x036aba02, 0x16825ced, 0xcf1c2b8a, 0x79b492a7, 0x07f2f0f3, 0x69e2a14e, 0xdaf4cd65, 0x05bed506, 0x34621fd1, 0xa6fe8ac4, 0x2e539d34, 0xf355a0a2, 0x8ae13205, 0xf6eb75a4, 0x83ec390b, 0x60efaa40, 0x719f065e, 0x6e1051bd, 0x218af93e, 0xdd063d96, 0x3e05aedd, 0xe6bd464d, 0x548db591, 0xc45d0571, 0x06d46f04, 0x5015ff60, 0x98fb2419, 0xbde997d6, 0x4043cc89, 0xd99e7767, 0xe842bdb0, 0x898b8807, 0x195b38e7, 0xc8eedb79, 0x7c0a47a1, 0x420fe97c, 0x841ec9f8, 0x00000000, 0x80868309, 0x2bed4832, 0x1170ac1e, 0x5a724e6c, 0x0efffbfd, 0x8538560f, 0xaed51e3d, 0x2d392736, 0x0fd9640a, 0x5ca62168, 0x5b54d19b, 0x362e3a24, 0x0a67b10c, 0x57e70f93, 0xee96d2b4, 0x9b919e1b, 0xc0c54f80, 0xdc20a261, 0x774b695a, 0x121a161c, 0x93ba0ae2, 0xa02ae5c0, 0x22e0433c, 0x1b171d12, 0x090d0b0e, 0x8bc7adf2, 0xb6a8b92d, 0x1ea9c814, 0xf1198557, 0x75074caf, 0x99ddbbee, 0x7f60fda3, 0x01269ff7, 0x72f5bc5c, 0x663bc544, 0xfb7e345b, 0x4329768b, 0x23c6dccb, 0xedfc68b6, 0xe4f163b8, 0x31dccad7, 0x63851042, 0x97224013, 0xc6112084, 0x4a247d85, 0xbb3df8d2, 0xf93211ae, 0x29a16dc7, 0x9e2f4b1d, 0xb230f3dc, 0x8652ec0d, 0xc1e3d077, 0xb3166c2b, 0x70b999a9, 0x9448fa11, 0xe9642247, 0xfc8cc4a8, 0xf03f1aa0, 0x7d2cd856, 0x3390ef22, 0x494ec787, 0x38d1c1d9, 0xcaa2fe8c, 0xd40b3698, 0xf581cfa6, 0x7ade28a5, 0xb78e26da, 0xadbfa43f, 0x3a9de42c, 0x78920d50, 0x5fcc9b6a, 0x7e466254, 0x8d13c2f6, 0xd8b8e890, 0x39f75e2e, 0xc3aff582, 0x5d80be9f, 0xd0937c69, 0xd52da96f, 0x2512b3cf, 0xac993bc8, 0x187da710, 0x9c636ee8, 0x3bbb7bdb, 0x267809cd, 0x5918f46e, 0x9ab701ec, 0x4f9aa883, 0x956e65e6, 0xffe67eaa, 0xbccf0821, 0x15e8e6ef, 0xe79bd9ba, 0x6f36ce4a, 0x9f09d4ea, 0xb07cd629, 0xa4b2af31, 0x3f23312a, 0xa59430c6, 0xa266c035, 0x4ebc3774, 0x82caa6fc, 0x90d0b0e0, 0xa7d81533, 0x04984af1, 0xecdaf741, 0xcd500e7f, 0x91f62f17, 0x4dd68d76, 0xefb04d43, 0xaa4d54cc, 0x9604dfe4, 0xd1b5e39e, 0x6a881b4c, 0x2c1fb8c1, 0x65517f46, 0x5eea049d, 0x8c355d01, 0x877473fa, 0x0b412efb, 0x671d5ab3, 0xdbd25292, 0x105633e9, 0xd647136d, 0xd7618c9a, 0xa10c7a37, 0xf8148e59, 0x133c89eb, 0xa927eece, 0x61c935b7, 0x1ce5ede1, 0x47b13c7a, 0xd2df599c, 0xf2733f55, 0x14ce7918, 0xc737bf73, 0xf7cdea53, 0xfdaa5b5f, 0x3d6f14df, 0x44db8678, 0xaff381ca, 0x68c43eb9, 0x24342c38, 0xa3405fc2, 0x1dc37216, 0xe2250cbc, 0x3c498b28, 0x0d9541ff, 0xa8017139, 0x0cb3de08, 0xb4e49cd8, 0x56c19064, 0xcb84617b, 0x32b670d5, 0x6c5c7448, 0xb85742d0]; // Transformations for decryption key expansion var U1 = [0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927, 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45, 0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69, 0xe090d0b0, 0xee99ddbb, 0xfc82caa6, 0xf28bc7ad, 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, 0x90d8b8e8, 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf, 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d, 0xc920ac66, 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a, 0xab73d323, 0xa57ade28, 0xb761c935, 0xb968c43e, 0x9357e70f, 0x9d5eea04, 0x8f45fd19, 0x814cf012, 0x3bab6bcb, 0x35a266c0, 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, 0x1f9d45f1, 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e, 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6, 0xa37f60fd, 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1, 0x894043cc, 0x87494ec7, 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8, 0xcf2512b3, 0xe51a3182, 0xeb133c89, 0xf9082b94, 0xf701269f, 0x4de6bd46, 0x43efb04d, 0x51f4a750, 0x5ffdaa5b, 0x75c2896a, 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815, 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24, 0x1791f62f, 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190, 0x4e69e2a1, 0x4060efaa, 0x527bf8b7, 0x5c72f5bc, 0x0605bed5, 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, 0x3e218af9, 0x302887f2, 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, 0x8acf1c2b, 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c, 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49, 0xd0b85742, 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc, 0x5dfec0e1, 0x53f7cdea, 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd, 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, 0x2db6a8b9, 0x23bfa5b2, 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, 0xa17c0a47, 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360, 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809, 0xc32f7502, 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e, 0x9ad7618c, 0x94de6c87, 0x86c57b9a, 0x88cc7691, 0xa2f355a0, 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, 0xea9f09d4, 0xe49604df, 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, 0xcea927ee, 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621, 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964, 0x0406d46f, 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043, 0x2e39f75e, 0x2030fa55, 0xec9ab701, 0xe293ba0a, 0xf088ad17, 0xfe81a01c, 0xd4be832d, 0xdab78e26, 0xc8ac993b, 0xc6a59430, 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, 0xa4f6eb75, 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba, 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b, 0x26354480, 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4, 0x44663bc5, 0x4a6f36ce, 0x587421d3, 0x567d2cd8, 0x37a10c7a, 0x39a80171, 0x2bb3166c, 0x25ba1b67, 0x0f853856, 0x018c355d, 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, 0x5bfb7e34, 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713, 0xd731dcca, 0xd938d1c1, 0xcb23c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3]; var U2 = [0x00000000, 0x0b0e090d, 0x161c121a, 0x1d121b17, 0x2c382434, 0x27362d39, 0x3a24362e, 0x312a3f23, 0x58704868, 0x537e4165, 0x4e6c5a72, 0x4562537f, 0x74486c5c, 0x7f466551, 0x62547e46, 0x695a774b, 0xb0e090d0, 0xbbee99dd, 0xa6fc82ca, 0xadf28bc7, 0x9cd8b4e4, 0x97d6bde9, 0x8ac4a6fe, 0x81caaff3, 0xe890d8b8, 0xe39ed1b5, 0xfe8ccaa2, 0xf582c3af, 0xc4a8fc8c, 0xcfa6f581, 0xd2b4ee96, 0xd9bae79b, 0x7bdb3bbb, 0x70d532b6, 0x6dc729a1, 0x66c920ac, 0x57e31f8f, 0x5ced1682, 0x41ff0d95, 0x4af10498, 0x23ab73d3, 0x28a57ade, 0x35b761c9, 0x3eb968c4, 0x0f9357e7, 0x049d5eea, 0x198f45fd, 0x12814cf0, 0xcb3bab6b, 0xc035a266, 0xdd27b971, 0xd629b07c, 0xe7038f5f, 0xec0d8652, 0xf11f9d45, 0xfa119448, 0x934be303, 0x9845ea0e, 0x8557f119, 0x8e59f814, 0xbf73c737, 0xb47dce3a, 0xa96fd52d, 0xa261dc20, 0xf6ad766d, 0xfda37f60, 0xe0b16477, 0xebbf6d7a, 0xda955259, 0xd19b5b54, 0xcc894043, 0xc787494e, 0xaedd3e05, 0xa5d33708, 0xb8c12c1f, 0xb3cf2512, 0x82e51a31, 0x89eb133c, 0x94f9082b, 0x9ff70126, 0x464de6bd, 0x4d43efb0, 0x5051f4a7, 0x5b5ffdaa, 0x6a75c289, 0x617bcb84, 0x7c69d093, 0x7767d99e, 0x1e3daed5, 0x1533a7d8, 0x0821bccf, 0x032fb5c2, 0x32058ae1, 0x390b83ec, 0x241998fb, 0x2f1791f6, 0x8d764dd6, 0x867844db, 0x9b6a5fcc, 0x906456c1, 0xa14e69e2, 0xaa4060ef, 0xb7527bf8, 0xbc5c72f5, 0xd50605be, 0xde080cb3, 0xc31a17a4, 0xc8141ea9, 0xf93e218a, 0xf2302887, 0xef223390, 0xe42c3a9d, 0x3d96dd06, 0x3698d40b, 0x2b8acf1c, 0x2084c611, 0x11aef932, 0x1aa0f03f, 0x07b2eb28, 0x0cbce225, 0x65e6956e, 0x6ee89c63, 0x73fa8774, 0x78f48e79, 0x49deb15a, 0x42d0b857, 0x5fc2a340, 0x54ccaa4d, 0xf741ecda, 0xfc4fe5d7, 0xe15dfec0, 0xea53f7cd, 0xdb79c8ee, 0xd077c1e3, 0xcd65daf4, 0xc66bd3f9, 0xaf31a4b2, 0xa43fadbf, 0xb92db6a8, 0xb223bfa5, 0x83098086, 0x8807898b, 0x9515929c, 0x9e1b9b91, 0x47a17c0a, 0x4caf7507, 0x51bd6e10, 0x5ab3671d, 0x6b99583e, 0x60975133, 0x7d854a24, 0x768b4329, 0x1fd13462, 0x14df3d6f, 0x09cd2678, 0x02c32f75, 0x33e91056, 0x38e7195b, 0x25f5024c, 0x2efb0b41, 0x8c9ad761, 0x8794de6c, 0x9a86c57b, 0x9188cc76, 0xa0a2f355, 0xabacfa58, 0xb6bee14f, 0xbdb0e842, 0xd4ea9f09, 0xdfe49604, 0xc2f68d13, 0xc9f8841e, 0xf8d2bb3d, 0xf3dcb230, 0xeecea927, 0xe5c0a02a, 0x3c7a47b1, 0x37744ebc, 0x2a6655ab, 0x21685ca6, 0x10426385, 0x1b4c6a88, 0x065e719f, 0x0d507892, 0x640a0fd9, 0x6f0406d4, 0x72161dc3, 0x791814ce, 0x48322bed, 0x433c22e0, 0x5e2e39f7, 0x552030fa, 0x01ec9ab7, 0x0ae293ba, 0x17f088ad, 0x1cfe81a0, 0x2dd4be83, 0x26dab78e, 0x3bc8ac99, 0x30c6a594, 0x599cd2df, 0x5292dbd2, 0x4f80c0c5, 0x448ec9c8, 0x75a4f6eb, 0x7eaaffe6, 0x63b8e4f1, 0x68b6edfc, 0xb10c0a67, 0xba02036a, 0xa710187d, 0xac1e1170, 0x9d342e53, 0x963a275e, 0x8b283c49, 0x80263544, 0xe97c420f, 0xe2724b02, 0xff605015, 0xf46e5918, 0xc544663b, 0xce4a6f36, 0xd3587421, 0xd8567d2c, 0x7a37a10c, 0x7139a801, 0x6c2bb316, 0x6725ba1b, 0x560f8538, 0x5d018c35, 0x40139722, 0x4b1d9e2f, 0x2247e964, 0x2949e069, 0x345bfb7e, 0x3f55f273, 0x0e7fcd50, 0x0571c45d, 0x1863df4a, 0x136dd647, 0xcad731dc, 0xc1d938d1, 0xdccb23c6, 0xd7c52acb, 0xe6ef15e8, 0xede11ce5, 0xf0f307f2, 0xfbfd0eff, 0x92a779b4, 0x99a970b9, 0x84bb6bae, 0x8fb562a3, 0xbe9f5d80, 0xb591548d, 0xa8834f9a, 0xa38d4697]; var U3 = [0x00000000, 0x0d0b0e09, 0x1a161c12, 0x171d121b, 0x342c3824, 0x3927362d, 0x2e3a2436, 0x23312a3f, 0x68587048, 0x65537e41, 0x724e6c5a, 0x7f456253, 0x5c74486c, 0x517f4665, 0x4662547e, 0x4b695a77, 0xd0b0e090, 0xddbbee99, 0xcaa6fc82, 0xc7adf28b, 0xe49cd8b4, 0xe997d6bd, 0xfe8ac4a6, 0xf381caaf, 0xb8e890d8, 0xb5e39ed1, 0xa2fe8cca, 0xaff582c3, 0x8cc4a8fc, 0x81cfa6f5, 0x96d2b4ee, 0x9bd9bae7, 0xbb7bdb3b, 0xb670d532, 0xa16dc729, 0xac66c920, 0x8f57e31f, 0x825ced16, 0x9541ff0d, 0x984af104, 0xd323ab73, 0xde28a57a, 0xc935b761, 0xc43eb968, 0xe70f9357, 0xea049d5e, 0xfd198f45, 0xf012814c, 0x6bcb3bab, 0x66c035a2, 0x71dd27b9, 0x7cd629b0, 0x5fe7038f, 0x52ec0d86, 0x45f11f9d, 0x48fa1194, 0x03934be3, 0x0e9845ea, 0x198557f1, 0x148e59f8, 0x37bf73c7, 0x3ab47dce, 0x2da96fd5, 0x20a261dc, 0x6df6ad76, 0x60fda37f, 0x77e0b164, 0x7aebbf6d, 0x59da9552, 0x54d19b5b, 0x43cc8940, 0x4ec78749, 0x05aedd3e, 0x08a5d337, 0x1fb8c12c, 0x12b3cf25, 0x3182e51a, 0x3c89eb13, 0x2b94f908, 0x269ff701, 0xbd464de6, 0xb04d43ef, 0xa75051f4, 0xaa5b5ffd, 0x896a75c2, 0x84617bcb, 0x937c69d0, 0x9e7767d9, 0xd51e3dae, 0xd81533a7, 0xcf0821bc, 0xc2032fb5, 0xe132058a, 0xec390b83, 0xfb241998, 0xf62f1791, 0xd68d764d, 0xdb867844, 0xcc9b6a5f, 0xc1906456, 0xe2a14e69, 0xefaa4060, 0xf8b7527b, 0xf5bc5c72, 0xbed50605, 0xb3de080c, 0xa4c31a17, 0xa9c8141e, 0x8af93e21, 0x87f23028, 0x90ef2233, 0x9de42c3a, 0x063d96dd, 0x0b3698d4, 0x1c2b8acf, 0x112084c6, 0x3211aef9, 0x3f1aa0f0, 0x2807b2eb, 0x250cbce2, 0x6e65e695, 0x636ee89c, 0x7473fa87, 0x7978f48e, 0x5a49deb1, 0x5742d0b8, 0x405fc2a3, 0x4d54ccaa, 0xdaf741ec, 0xd7fc4fe5, 0xc0e15dfe, 0xcdea53f7, 0xeedb79c8, 0xe3d077c1, 0xf4cd65da, 0xf9c66bd3, 0xb2af31a4, 0xbfa43fad, 0xa8b92db6, 0xa5b223bf, 0x86830980, 0x8b880789, 0x9c951592, 0x919e1b9b, 0x0a47a17c, 0x074caf75, 0x1051bd6e, 0x1d5ab367, 0x3e6b9958, 0x33609751, 0x247d854a, 0x29768b43, 0x621fd134, 0x6f14df3d, 0x7809cd26, 0x7502c32f, 0x5633e910, 0x5b38e719, 0x4c25f502, 0x412efb0b, 0x618c9ad7, 0x6c8794de, 0x7b9a86c5, 0x769188cc, 0x55a0a2f3, 0x58abacfa, 0x4fb6bee1, 0x42bdb0e8, 0x09d4ea9f, 0x04dfe496, 0x13c2f68d, 0x1ec9f884, 0x3df8d2bb, 0x30f3dcb2, 0x27eecea9, 0x2ae5c0a0, 0xb13c7a47, 0xbc37744e, 0xab2a6655, 0xa621685c, 0x85104263, 0x881b4c6a, 0x9f065e71, 0x920d5078, 0xd9640a0f, 0xd46f0406, 0xc372161d, 0xce791814, 0xed48322b, 0xe0433c22, 0xf75e2e39, 0xfa552030, 0xb701ec9a, 0xba0ae293, 0xad17f088, 0xa01cfe81, 0x832dd4be, 0x8e26dab7, 0x993bc8ac, 0x9430c6a5, 0xdf599cd2, 0xd25292db, 0xc54f80c0, 0xc8448ec9, 0xeb75a4f6, 0xe67eaaff, 0xf163b8e4, 0xfc68b6ed, 0x67b10c0a, 0x6aba0203, 0x7da71018, 0x70ac1e11, 0x539d342e, 0x5e963a27, 0x498b283c, 0x44802635, 0x0fe97c42, 0x02e2724b, 0x15ff6050, 0x18f46e59, 0x3bc54466, 0x36ce4a6f, 0x21d35874, 0x2cd8567d, 0x0c7a37a1, 0x017139a8, 0x166c2bb3, 0x1b6725ba, 0x38560f85, 0x355d018c, 0x22401397, 0x2f4b1d9e, 0x642247e9, 0x692949e0, 0x7e345bfb, 0x733f55f2, 0x500e7fcd, 0x5d0571c4, 0x4a1863df, 0x47136dd6, 0xdccad731, 0xd1c1d938, 0xc6dccb23, 0xcbd7c52a, 0xe8e6ef15, 0xe5ede11c, 0xf2f0f307, 0xfffbfd0e, 0xb492a779, 0xb999a970, 0xae84bb6b, 0xa38fb562, 0x80be9f5d, 0x8db59154, 0x9aa8834f, 0x97a38d46]; var U4 = [0x00000000, 0x090d0b0e, 0x121a161c, 0x1b171d12, 0x24342c38, 0x2d392736, 0x362e3a24, 0x3f23312a, 0x48685870, 0x4165537e, 0x5a724e6c, 0x537f4562, 0x6c5c7448, 0x65517f46, 0x7e466254, 0x774b695a, 0x90d0b0e0, 0x99ddbbee, 0x82caa6fc, 0x8bc7adf2, 0xb4e49cd8, 0xbde997d6, 0xa6fe8ac4, 0xaff381ca, 0xd8b8e890, 0xd1b5e39e, 0xcaa2fe8c, 0xc3aff582, 0xfc8cc4a8, 0xf581cfa6, 0xee96d2b4, 0xe79bd9ba, 0x3bbb7bdb, 0x32b670d5, 0x29a16dc7, 0x20ac66c9, 0x1f8f57e3, 0x16825ced, 0x0d9541ff, 0x04984af1, 0x73d323ab, 0x7ade28a5, 0x61c935b7, 0x68c43eb9, 0x57e70f93, 0x5eea049d, 0x45fd198f, 0x4cf01281, 0xab6bcb3b, 0xa266c035, 0xb971dd27, 0xb07cd629, 0x8f5fe703, 0x8652ec0d, 0x9d45f11f, 0x9448fa11, 0xe303934b, 0xea0e9845, 0xf1198557, 0xf8148e59, 0xc737bf73, 0xce3ab47d, 0xd52da96f, 0xdc20a261, 0x766df6ad, 0x7f60fda3, 0x6477e0b1, 0x6d7aebbf, 0x5259da95, 0x5b54d19b, 0x4043cc89, 0x494ec787, 0x3e05aedd, 0x3708a5d3, 0x2c1fb8c1, 0x2512b3cf, 0x1a3182e5, 0x133c89eb, 0x082b94f9, 0x01269ff7, 0xe6bd464d, 0xefb04d43, 0xf4a75051, 0xfdaa5b5f, 0xc2896a75, 0xcb84617b, 0xd0937c69, 0xd99e7767, 0xaed51e3d, 0xa7d81533, 0xbccf0821, 0xb5c2032f, 0x8ae13205, 0x83ec390b, 0x98fb2419, 0x91f62f17, 0x4dd68d76, 0x44db8678, 0x5fcc9b6a, 0x56c19064, 0x69e2a14e, 0x60efaa40, 0x7bf8b752, 0x72f5bc5c, 0x05bed506, 0x0cb3de08, 0x17a4c31a, 0x1ea9c814, 0x218af93e, 0x2887f230, 0x3390ef22, 0x3a9de42c, 0xdd063d96, 0xd40b3698, 0xcf1c2b8a, 0xc6112084, 0xf93211ae, 0xf03f1aa0, 0xeb2807b2, 0xe2250cbc, 0x956e65e6, 0x9c636ee8, 0x877473fa, 0x8e7978f4, 0xb15a49de, 0xb85742d0, 0xa3405fc2, 0xaa4d54cc, 0xecdaf741, 0xe5d7fc4f, 0xfec0e15d, 0xf7cdea53, 0xc8eedb79, 0xc1e3d077, 0xdaf4cd65, 0xd3f9c66b, 0xa4b2af31, 0xadbfa43f, 0xb6a8b92d, 0xbfa5b223, 0x80868309, 0x898b8807, 0x929c9515, 0x9b919e1b, 0x7c0a47a1, 0x75074caf, 0x6e1051bd, 0x671d5ab3, 0x583e6b99, 0x51336097, 0x4a247d85, 0x4329768b, 0x34621fd1, 0x3d6f14df, 0x267809cd, 0x2f7502c3, 0x105633e9, 0x195b38e7, 0x024c25f5, 0x0b412efb, 0xd7618c9a, 0xde6c8794, 0xc57b9a86, 0xcc769188, 0xf355a0a2, 0xfa58abac, 0xe14fb6be, 0xe842bdb0, 0x9f09d4ea, 0x9604dfe4, 0x8d13c2f6, 0x841ec9f8, 0xbb3df8d2, 0xb230f3dc, 0xa927eece, 0xa02ae5c0, 0x47b13c7a, 0x4ebc3774, 0x55ab2a66, 0x5ca62168, 0x63851042, 0x6a881b4c, 0x719f065e, 0x78920d50, 0x0fd9640a, 0x06d46f04, 0x1dc37216, 0x14ce7918, 0x2bed4832, 0x22e0433c, 0x39f75e2e, 0x30fa5520, 0x9ab701ec, 0x93ba0ae2, 0x88ad17f0, 0x81a01cfe, 0xbe832dd4, 0xb78e26da, 0xac993bc8, 0xa59430c6, 0xd2df599c, 0xdbd25292, 0xc0c54f80, 0xc9c8448e, 0xf6eb75a4, 0xffe67eaa, 0xe4f163b8, 0xedfc68b6, 0x0a67b10c, 0x036aba02, 0x187da710, 0x1170ac1e, 0x2e539d34, 0x275e963a, 0x3c498b28, 0x35448026, 0x420fe97c, 0x4b02e272, 0x5015ff60, 0x5918f46e, 0x663bc544, 0x6f36ce4a, 0x7421d358, 0x7d2cd856, 0xa10c7a37, 0xa8017139, 0xb3166c2b, 0xba1b6725, 0x8538560f, 0x8c355d01, 0x97224013, 0x9e2f4b1d, 0xe9642247, 0xe0692949, 0xfb7e345b, 0xf2733f55, 0xcd500e7f, 0xc45d0571, 0xdf4a1863, 0xd647136d, 0x31dccad7, 0x38d1c1d9, 0x23c6dccb, 0x2acbd7c5, 0x15e8e6ef, 0x1ce5ede1, 0x07f2f0f3, 0x0efffbfd, 0x79b492a7, 0x70b999a9, 0x6bae84bb, 0x62a38fb5, 0x5d80be9f, 0x548db591, 0x4f9aa883, 0x4697a38d]; function convertToInt32(bytes) { var result = []; for (var i = 0; i < bytes.length; i += 4) { result.push( (bytes[i ] << 24) | (bytes[i + 1] << 16) | (bytes[i + 2] << 8) | bytes[i + 3] ); } return result; } var AES = function(key) { if (!(this instanceof AES)) { throw Error('AES must be instanitated with `new`'); } Object.defineProperty(this, 'key', { value: coerceArray(key, true) }); this._prepare(); } AES.prototype._prepare = function() { var rounds = numberOfRounds[this.key.length]; if (rounds == null) { throw new Error('invalid key size (must be 16, 24 or 32 bytes)'); } // encryption round keys this._Ke = []; // decryption round keys this._Kd = []; for (var i = 0; i <= rounds; i++) { this._Ke.push([0, 0, 0, 0]); this._Kd.push([0, 0, 0, 0]); } var roundKeyCount = (rounds + 1) * 4; var KC = this.key.length / 4; // convert the key into ints var tk = convertToInt32(this.key); // copy values into round key arrays var index; for (var i = 0; i < KC; i++) { index = i >> 2; this._Ke[index][i % 4] = tk[i]; this._Kd[rounds - index][i % 4] = tk[i]; } // key expansion (fips-197 section 5.2) var rconpointer = 0; var t = KC, tt; while (t < roundKeyCount) { tt = tk[KC - 1]; tk[0] ^= ((S[(tt >> 16) & 0xFF] << 24) ^ (S[(tt >> 8) & 0xFF] << 16) ^ (S[ tt & 0xFF] << 8) ^ S[(tt >> 24) & 0xFF] ^ (rcon[rconpointer] << 24)); rconpointer += 1; // key expansion (for non-256 bit) if (KC != 8) { for (var i = 1; i < KC; i++) { tk[i] ^= tk[i - 1]; } // key expansion for 256-bit keys is "slightly different" (fips-197) } else { for (var i = 1; i < (KC / 2); i++) { tk[i] ^= tk[i - 1]; } tt = tk[(KC / 2) - 1]; tk[KC / 2] ^= (S[ tt & 0xFF] ^ (S[(tt >> 8) & 0xFF] << 8) ^ (S[(tt >> 16) & 0xFF] << 16) ^ (S[(tt >> 24) & 0xFF] << 24)); for (var i = (KC / 2) + 1; i < KC; i++) { tk[i] ^= tk[i - 1]; } } // copy values into round key arrays var i = 0, r, c; while (i < KC && t < roundKeyCount) { r = t >> 2; c = t % 4; this._Ke[r][c] = tk[i]; this._Kd[rounds - r][c] = tk[i++]; t++; } } // inverse-cipher-ify the decryption round key (fips-197 section 5.3) for (var r = 1; r < rounds; r++) { for (var c = 0; c < 4; c++) { tt = this._Kd[r][c]; this._Kd[r][c] = (U1[(tt >> 24) & 0xFF] ^ U2[(tt >> 16) & 0xFF] ^ U3[(tt >> 8) & 0xFF] ^ U4[ tt & 0xFF]); } } } AES.prototype.encrypt = function(plaintext) { if (plaintext.length != 16) { throw new Error('invalid plaintext size (must be 16 bytes)'); } var rounds = this._Ke.length - 1; var a = [0, 0, 0, 0]; // convert plaintext to (ints ^ key) var t = convertToInt32(plaintext); for (var i = 0; i < 4; i++) { t[i] ^= this._Ke[0][i]; } // apply round transforms for (var r = 1; r < rounds; r++) { for (var i = 0; i < 4; i++) { a[i] = (T1[(t[ i ] >> 24) & 0xff] ^ T2[(t[(i + 1) % 4] >> 16) & 0xff] ^ T3[(t[(i + 2) % 4] >> 8) & 0xff] ^ T4[ t[(i + 3) % 4] & 0xff] ^ this._Ke[r][i]); } t = a.slice(); } // the last round is special var result = createArray(16), tt; for (var i = 0; i < 4; i++) { tt = this._Ke[rounds][i]; result[4 * i ] = (S[(t[ i ] >> 24) & 0xff] ^ (tt >> 24)) & 0xff; result[4 * i + 1] = (S[(t[(i + 1) % 4] >> 16) & 0xff] ^ (tt >> 16)) & 0xff; result[4 * i + 2] = (S[(t[(i + 2) % 4] >> 8) & 0xff] ^ (tt >> 8)) & 0xff; result[4 * i + 3] = (S[ t[(i + 3) % 4] & 0xff] ^ tt ) & 0xff; } return result; } AES.prototype.decrypt = function(ciphertext) { if (ciphertext.length != 16) { throw new Error('invalid ciphertext size (must be 16 bytes)'); } var rounds = this._Kd.length - 1; var a = [0, 0, 0, 0]; // convert plaintext to (ints ^ key) var t = convertToInt32(ciphertext); for (var i = 0; i < 4; i++) { t[i] ^= this._Kd[0][i]; } // apply round transforms for (var r = 1; r < rounds; r++) { for (var i = 0; i < 4; i++) { a[i] = (T5[(t[ i ] >> 24) & 0xff] ^ T6[(t[(i + 3) % 4] >> 16) & 0xff] ^ T7[(t[(i + 2) % 4] >> 8) & 0xff] ^ T8[ t[(i + 1) % 4] & 0xff] ^ this._Kd[r][i]); } t = a.slice(); } // the last round is special var result = createArray(16), tt; for (var i = 0; i < 4; i++) { tt = this._Kd[rounds][i]; result[4 * i ] = (Si[(t[ i ] >> 24) & 0xff] ^ (tt >> 24)) & 0xff; result[4 * i + 1] = (Si[(t[(i + 3) % 4] >> 16) & 0xff] ^ (tt >> 16)) & 0xff; result[4 * i + 2] = (Si[(t[(i + 2) % 4] >> 8) & 0xff] ^ (tt >> 8)) & 0xff; result[4 * i + 3] = (Si[ t[(i + 1) % 4] & 0xff] ^ tt ) & 0xff; } return result; } /** * Mode Of Operation - Electonic Codebook (ECB) */ var ModeOfOperationECB = function(key) { if (!(this instanceof ModeOfOperationECB)) { throw Error('AES must be instanitated with `new`'); } this.description = "Electronic Code Block"; this.name = "ecb"; this._aes = new AES(key); } ModeOfOperationECB.prototype.encrypt = function(plaintext) { plaintext = coerceArray(plaintext); if ((plaintext.length % 16) !== 0) { throw new Error('invalid plaintext size (must be multiple of 16 bytes)'); } var ciphertext = createArray(plaintext.length); var block = createArray(16); for (var i = 0; i < plaintext.length; i += 16) { copyArray(plaintext, block, 0, i, i + 16); block = this._aes.encrypt(block); copyArray(block, ciphertext, i); } return ciphertext; } ModeOfOperationECB.prototype.decrypt = function(ciphertext) { ciphertext = coerceArray(ciphertext); if ((ciphertext.length % 16) !== 0) { throw new Error('invalid ciphertext size (must be multiple of 16 bytes)'); } var plaintext = createArray(ciphertext.length); var block = createArray(16); for (var i = 0; i < ciphertext.length; i += 16) { copyArray(ciphertext, block, 0, i, i + 16); block = this._aes.decrypt(block); copyArray(block, plaintext, i); } return plaintext; } /** * Mode Of Operation - Cipher Block Chaining (CBC) */ var ModeOfOperationCBC = function(key, iv) { if (!(this instanceof ModeOfOperationCBC)) { throw Error('AES must be instanitated with `new`'); } this.description = "Cipher Block Chaining"; this.name = "cbc"; if (!iv) { iv = createArray(16); } else if (iv.length != 16) { throw new Error('invalid initialation vector size (must be 16 bytes)'); } this._lastCipherblock = coerceArray(iv, true); this._aes = new AES(key); } ModeOfOperationCBC.prototype.encrypt = function(plaintext) { plaintext = coerceArray(plaintext); if ((plaintext.length % 16) !== 0) { throw new Error('invalid plaintext size (must be multiple of 16 bytes)'); } var ciphertext = createArray(plaintext.length); var block = createArray(16); for (var i = 0; i < plaintext.length; i += 16) { copyArray(plaintext, block, 0, i, i + 16); for (var j = 0; j < 16; j++) { block[j] ^= this._lastCipherblock[j]; } this._lastCipherblock = this._aes.encrypt(block); copyArray(this._lastCipherblock, ciphertext, i); } return ciphertext; } ModeOfOperationCBC.prototype.decrypt = function(ciphertext) { ciphertext = coerceArray(ciphertext); if ((ciphertext.length % 16) !== 0) { throw new Error('invalid ciphertext size (must be multiple of 16 bytes)'); } var plaintext = createArray(ciphertext.length); var block = createArray(16); for (var i = 0; i < ciphertext.length; i += 16) { copyArray(ciphertext, block, 0, i, i + 16); block = this._aes.decrypt(block); for (var j = 0; j < 16; j++) { plaintext[i + j] = block[j] ^ this._lastCipherblock[j]; } copyArray(ciphertext, this._lastCipherblock, 0, i, i + 16); } return plaintext; } /** * Mode Of Operation - Cipher Feedback (CFB) */ var ModeOfOperationCFB = function(key, iv, segmentSize) { if (!(this instanceof ModeOfOperationCFB)) { throw Error('AES must be instanitated with `new`'); } this.description = "Cipher Feedback"; this.name = "cfb"; if (!iv) { iv = createArray(16); } else if (iv.length != 16) { throw new Error('invalid initialation vector size (must be 16 size)'); } if (!segmentSize) { segmentSize = 1; } this.segmentSize = segmentSize; this._shiftRegister = coerceArray(iv, true); this._aes = new AES(key); } ModeOfOperationCFB.prototype.encrypt = function(plaintext) { if ((plaintext.length % this.segmentSize) != 0) { throw new Error('invalid plaintext size (must be segmentSize bytes)'); } var encrypted = coerceArray(plaintext, true); var xorSegment; for (var i = 0; i < encrypted.length; i += this.segmentSize) { xorSegment = this._aes.encrypt(this._shiftRegister); for (var j = 0; j < this.segmentSize; j++) { encrypted[i + j] ^= xorSegment[j]; } // Shift the register copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize); copyArray(encrypted, this._shiftRegister, 16 - this.segmentSize, i, i + this.segmentSize); } return encrypted; } ModeOfOperationCFB.prototype.decrypt = function(ciphertext) { if ((ciphertext.length % this.segmentSize) != 0) { throw new Error('invalid ciphertext size (must be segmentSize bytes)'); } var plaintext = coerceArray(ciphertext, true); var xorSegment; for (var i = 0; i < plaintext.length; i += this.segmentSize) { xorSegment = this._aes.encrypt(this._shiftRegister); for (var j = 0; j < this.segmentSize; j++) { plaintext[i + j] ^= xorSegment[j]; } // Shift the register copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize); copyArray(ciphertext, this._shiftRegister, 16 - this.segmentSize, i, i + this.segmentSize); } return plaintext; } /** * Mode Of Operation - Output Feedback (OFB) */ var ModeOfOperationOFB = function(key, iv) { if (!(this instanceof ModeOfOperationOFB)) { throw Error('AES must be instanitated with `new`'); } this.description = "Output Feedback"; this.name = "ofb"; if (!iv) { iv = createArray(16); } else if (iv.length != 16) { throw new Error('invalid initialation vector size (must be 16 bytes)'); } this._lastPrecipher = coerceArray(iv, true); this._lastPrecipherIndex = 16; this._aes = new AES(key); } ModeOfOperationOFB.prototype.encrypt = function(plaintext) { var encrypted = coerceArray(plaintext, true); for (var i = 0; i < encrypted.length; i++) { if (this._lastPrecipherIndex === 16) { this._lastPrecipher = this._aes.encrypt(this._lastPrecipher); this._lastPrecipherIndex = 0; } encrypted[i] ^= this._lastPrecipher[this._lastPrecipherIndex++]; } return encrypted; } // Decryption is symetric ModeOfOperationOFB.prototype.decrypt = ModeOfOperationOFB.prototype.encrypt; /** * Counter object for CTR common mode of operation */ var Counter = function(initialValue) { if (!(this instanceof Counter)) { throw Error('Counter must be instanitated with `new`'); } // We allow 0, but anything false-ish uses the default 1 if (initialValue !== 0 && !initialValue) { initialValue = 1; } if (typeof(initialValue) === 'number') { this._counter = createArray(16); this.setValue(initialValue); } else { this.setBytes(initialValue); } } Counter.prototype.setValue = function(value) { if (typeof(value) !== 'number' || parseInt(value) != value) { throw new Error('invalid counter value (must be an integer)'); } for (var index = 15; index >= 0; --index) { this._counter[index] = value % 256; value = value >> 8; } } Counter.prototype.setBytes = function(bytes) { bytes = coerceArray(bytes, true); if (bytes.length != 16) { throw new Error('invalid counter bytes size (must be 16 bytes)'); } this._counter = bytes; }; Counter.prototype.increment = function() { for (var i = 15; i >= 0; i--) { if (this._counter[i] === 255) { this._counter[i] = 0; } else { this._counter[i]++; break; } } } /** * Mode Of Operation - Counter (CTR) */ var ModeOfOperationCTR = function(key, counter) { if (!(this instanceof ModeOfOperationCTR)) { throw Error('AES must be instanitated with `new`'); } this.description = "Counter"; this.name = "ctr"; if (!(counter instanceof Counter)) { counter = new Counter(counter) } this._counter = counter; this._remainingCounter = null; this._remainingCounterIndex = 16; this._aes = new AES(key); } ModeOfOperationCTR.prototype.encrypt = function(plaintext) { var encrypted = coerceArray(plaintext, true); for (var i = 0; i < encrypted.length; i++) { if (this._remainingCounterIndex === 16) { this._remainingCounter = this._aes.encrypt(this._counter._counter); this._remainingCounterIndex = 0; this._counter.increment(); } encrypted[i] ^= this._remainingCounter[this._remainingCounterIndex++]; } return encrypted; } // Decryption is symetric ModeOfOperationCTR.prototype.decrypt = ModeOfOperationCTR.prototype.encrypt; /////////////////////// // Padding // See:https://tools.ietf.org/html/rfc2315 function pkcs7pad(data) { data = coerceArray(data, true); var padder = 16 - (data.length % 16); var result = createArray(data.length + padder); copyArray(data, result); for (var i = data.length; i < result.length; i++) { result[i] = padder; } return result; } function pkcs7strip(data) { data = coerceArray(data, true); if (data.length < 16) { throw new Error('PKCS#7 invalid length'); } var padder = data[data.length - 1]; if (padder > 16) { throw new Error('PKCS#7 padding byte out of range'); } var length = data.length - padder; for (var i = 0; i < padder; i++) { if (data[length + i] !== padder) { throw new Error('PKCS#7 invalid padding byte'); } } var result = createArray(length); copyArray(data, result, 0, 0, length); return result; } /////////////////////// // Exporting // The block cipher var aesjs = { AES: AES, Counter: Counter, ModeOfOperation: { ecb: ModeOfOperationECB, cbc: ModeOfOperationCBC, cfb: ModeOfOperationCFB, ofb: ModeOfOperationOFB, ctr: ModeOfOperationCTR }, utils: { hex: convertHex, utf8: convertUtf8 }, padding: { pkcs7: { pad: pkcs7pad, strip: pkcs7strip } }, _arrayTest: { coerceArray: coerceArray, createArray: createArray, copyArray: copyArray, } }; // node.js if (true) { module.exports = aesjs // RequireJS/AMD // http://www.requirejs.org/docs/api.html // https://github.com/amdjs/amdjs-api/wiki/AMD } else {} })(this); /***/ }), /***/ 79742: /***/ (function(__unused_webpack_module, exports) { "use strict"; exports.byteLength = byteLength exports.toByteArray = toByteArray exports.fromByteArray = fromByteArray var lookup = [] var revLookup = [] var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' for (var i = 0, len = code.length; i < len; ++i) { lookup[i] = code[i] revLookup[code.charCodeAt(i)] = i } // Support decoding URL-safe base64 strings, as Node.js does. // See: https://en.wikipedia.org/wiki/Base64#URL_applications revLookup['-'.charCodeAt(0)] = 62 revLookup['_'.charCodeAt(0)] = 63 function getLens (b64) { var len = b64.length if (len % 4 > 0) { throw new Error('Invalid string. Length must be a multiple of 4') } // Trim off extra bytes after placeholder bytes are found // See: https://github.com/beatgammit/base64-js/issues/42 var validLen = b64.indexOf('=') if (validLen === -1) validLen = len var placeHoldersLen = validLen === len ? 0 : 4 - (validLen % 4) return [validLen, placeHoldersLen] } // base64 is 4/3 + up to two characters of the original data function byteLength (b64) { var lens = getLens(b64) var validLen = lens[0] var placeHoldersLen = lens[1] return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen } function _byteLength (b64, validLen, placeHoldersLen) { return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen } function toByteArray (b64) { var tmp var lens = getLens(b64) var validLen = lens[0] var placeHoldersLen = lens[1] var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) var curByte = 0 // if there are placeholders, only get up to the last complete 4 chars var len = placeHoldersLen > 0 ? validLen - 4 : validLen var i for (i = 0; i < len; i += 4) { tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)] arr[curByte++] = (tmp >> 16) & 0xFF arr[curByte++] = (tmp >> 8) & 0xFF arr[curByte++] = tmp & 0xFF } if (placeHoldersLen === 2) { tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4) arr[curByte++] = tmp & 0xFF } if (placeHoldersLen === 1) { tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2) arr[curByte++] = (tmp >> 8) & 0xFF arr[curByte++] = tmp & 0xFF } return arr } function tripletToBase64 (num) { return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F] } function encodeChunk (uint8, start, end) { var tmp var output = [] for (var i = start; i < end; i += 3) { tmp = ((uint8[i] << 16) & 0xFF0000) + ((uint8[i + 1] << 8) & 0xFF00) + (uint8[i + 2] & 0xFF) output.push(tripletToBase64(tmp)) } return output.join('') } function fromByteArray (uint8) { var tmp var len = uint8.length var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes var parts = [] var maxChunkLength = 16383 // must be multiple of 3 // go through the array every three bytes, we'll deal with trailing stuff later for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength))) } // pad the end with zeros, but make sure to not forget the extra bytes if (extraBytes === 1) { tmp = uint8[len - 1] parts.push( lookup[tmp >> 2] + lookup[(tmp << 4) & 0x3F] + '==' ) } else if (extraBytes === 2) { tmp = (uint8[len - 2] << 8) + uint8[len - 1] parts.push( lookup[tmp >> 10] + lookup[(tmp >> 4) & 0x3F] + lookup[(tmp << 2) & 0x3F] + '=' ) } return parts.join('') } /***/ }), /***/ 92882: /***/ (function(module) { "use strict"; var ALPHABET = 'qpzry9x8gf2tvdw0s3jn54khce6mua7l' // pre-compute lookup table var ALPHABET_MAP = {} for (var z = 0; z < ALPHABET.length; z++) { var x = ALPHABET.charAt(z) if (ALPHABET_MAP[x] !== undefined) throw new TypeError(x + ' is ambiguous') ALPHABET_MAP[x] = z } function polymodStep (pre) { var b = pre >> 25 return ((pre & 0x1FFFFFF) << 5) ^ (-((b >> 0) & 1) & 0x3b6a57b2) ^ (-((b >> 1) & 1) & 0x26508e6d) ^ (-((b >> 2) & 1) & 0x1ea119fa) ^ (-((b >> 3) & 1) & 0x3d4233dd) ^ (-((b >> 4) & 1) & 0x2a1462b3) } function prefixChk (prefix) { var chk = 1 for (var i = 0; i < prefix.length; ++i) { var c = prefix.charCodeAt(i) if (c < 33 || c > 126) return 'Invalid prefix (' + prefix + ')' chk = polymodStep(chk) ^ (c >> 5) } chk = polymodStep(chk) for (i = 0; i < prefix.length; ++i) { var v = prefix.charCodeAt(i) chk = polymodStep(chk) ^ (v & 0x1f) } return chk } function encode (prefix, words, LIMIT) { LIMIT = LIMIT || 90 if ((prefix.length + 7 + words.length) > LIMIT) throw new TypeError('Exceeds length limit') prefix = prefix.toLowerCase() // determine chk mod var chk = prefixChk(prefix) if (typeof chk === 'string') throw new Error(chk) var result = prefix + '1' for (var i = 0; i < words.length; ++i) { var x = words[i] if ((x >> 5) !== 0) throw new Error('Non 5-bit word') chk = polymodStep(chk) ^ x result += ALPHABET.charAt(x) } for (i = 0; i < 6; ++i) { chk = polymodStep(chk) } chk ^= 1 for (i = 0; i < 6; ++i) { var v = (chk >> ((5 - i) * 5)) & 0x1f result += ALPHABET.charAt(v) } return result } function __decode (str, LIMIT) { LIMIT = LIMIT || 90 if (str.length < 8) return str + ' too short' if (str.length > LIMIT) return 'Exceeds length limit' // don't allow mixed case var lowered = str.toLowerCase() var uppered = str.toUpperCase() if (str !== lowered && str !== uppered) return 'Mixed-case string ' + str str = lowered var split = str.lastIndexOf('1') if (split === -1) return 'No separator character for ' + str if (split === 0) return 'Missing prefix for ' + str var prefix = str.slice(0, split) var wordChars = str.slice(split + 1) if (wordChars.length < 6) return 'Data too short' var chk = prefixChk(prefix) if (typeof chk === 'string') return chk var words = [] for (var i = 0; i < wordChars.length; ++i) { var c = wordChars.charAt(i) var v = ALPHABET_MAP[c] if (v === undefined) return 'Unknown character ' + c chk = polymodStep(chk) ^ v // not in the checksum? if (i + 6 >= wordChars.length) continue words.push(v) } if (chk !== 1) return 'Invalid checksum for ' + str return { prefix: prefix, words: words } } function decodeUnsafe () { var res = __decode.apply(null, arguments) if (typeof res === 'object') return res } function decode (str) { var res = __decode.apply(null, arguments) if (typeof res === 'object') return res throw new Error(res) } function convert (data, inBits, outBits, pad) { var value = 0 var bits = 0 var maxV = (1 << outBits) - 1 var result = [] for (var i = 0; i < data.length; ++i) { value = (value << inBits) | data[i] bits += inBits while (bits >= outBits) { bits -= outBits result.push((value >> bits) & maxV) } } if (pad) { if (bits > 0) { result.push((value << (outBits - bits)) & maxV) } } else { if (bits >= inBits) return 'Excess padding' if ((value << (outBits - bits)) & maxV) return 'Non-zero padding' } return result } function toWordsUnsafe (bytes) { var res = convert(bytes, 8, 5, true) if (Array.isArray(res)) return res } function toWords (bytes) { var res = convert(bytes, 8, 5, true) if (Array.isArray(res)) return res throw new Error(res) } function fromWordsUnsafe (words) { var res = convert(words, 5, 8, false) if (Array.isArray(res)) return res } function fromWords (words) { var res = convert(words, 5, 8, false) if (Array.isArray(res)) return res throw new Error(res) } module.exports = { decodeUnsafe: decodeUnsafe, decode: decode, encode: encode, toWordsUnsafe: toWordsUnsafe, toWords: toWords, fromWordsUnsafe: fromWordsUnsafe, fromWords: fromWords } /***/ }), /***/ 93302: /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_RESULT__;/* * big.js v5.2.2 * A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic. * Copyright (c) 2018 Michael Mclaughlin * https://github.com/MikeMcl/big.js/LICENCE */ ;(function (GLOBAL) { 'use strict'; var Big, /************************************** EDITABLE DEFAULTS *****************************************/ // The default values below must be integers within the stated ranges. /* * The maximum number of decimal places (DP) of the results of operations involving division: * div and sqrt, and pow with negative exponents. */ DP = 20, // 0 to MAX_DP /* * The rounding mode (RM) used when rounding to the above decimal places. * * 0 Towards zero (i.e. truncate, no rounding). (ROUND_DOWN) * 1 To nearest neighbour. If equidistant, round up. (ROUND_HALF_UP) * 2 To nearest neighbour. If equidistant, to even. (ROUND_HALF_EVEN) * 3 Away from zero. (ROUND_UP) */ RM = 1, // 0, 1, 2 or 3 // The maximum value of DP and Big.DP. MAX_DP = 1E6, // 0 to 1000000 // The maximum magnitude of the exponent argument to the pow method. MAX_POWER = 1E6, // 1 to 1000000 /* * The negative exponent (NE) at and beneath which toString returns exponential notation. * (JavaScript numbers: -7) * -1000000 is the minimum recommended exponent value of a Big. */ NE = -7, // 0 to -1000000 /* * The positive exponent (PE) at and above which toString returns exponential notation. * (JavaScript numbers: 21) * 1000000 is the maximum recommended exponent value of a Big. * (This limit is not enforced or checked.) */ PE = 21, // 0 to 1000000 /**************************************************************************************************/ // Error messages. NAME = '[big.js] ', INVALID = NAME + 'Invalid ', INVALID_DP = INVALID + 'decimal places', INVALID_RM = INVALID + 'rounding mode', DIV_BY_ZERO = NAME + 'Division by zero', // The shared prototype object. P = {}, UNDEFINED = void 0, NUMERIC = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i; /* * Create and return a Big constructor. * */ function _Big_() { /* * The Big constructor and exported function. * Create and return a new instance of a Big number object. * * n {number|string|Big} A numeric value. */ function Big(n) { var x = this; // Enable constructor usage without new. if (!(x instanceof Big)) return n === UNDEFINED ? _Big_() : new Big(n); // Duplicate. if (n instanceof Big) { x.s = n.s; x.e = n.e; x.c = n.c.slice(); } else { parse(x, n); } /* * Retain a reference to this Big constructor, and shadow Big.prototype.constructor which * points to Object. */ x.constructor = Big; } Big.prototype = P; Big.DP = DP; Big.RM = RM; Big.NE = NE; Big.PE = PE; Big.version = '5.2.2'; return Big; } /* * Parse the number or string value passed to a Big constructor. * * x {Big} A Big number instance. * n {number|string} A numeric value. */ function parse(x, n) { var e, i, nl; // Minus zero? if (n === 0 && 1 / n < 0) n = '-0'; else if (!NUMERIC.test(n += '')) throw Error(INVALID + 'number'); // Determine sign. x.s = n.charAt(0) == '-' ? (n = n.slice(1), -1) : 1; // Decimal point? if ((e = n.indexOf('.')) > -1) n = n.replace('.', ''); // Exponential form? if ((i = n.search(/e/i)) > 0) { // Determine exponent. if (e < 0) e = i; e += +n.slice(i + 1); n = n.substring(0, i); } else if (e < 0) { // Integer. e = n.length; } nl = n.length; // Determine leading zeros. for (i = 0; i < nl && n.charAt(i) == '0';) ++i; if (i == nl) { // Zero. x.c = [x.e = 0]; } else { // Determine trailing zeros. for (; nl > 0 && n.charAt(--nl) == '0';); x.e = e - i - 1; x.c = []; // Convert string to array of digits without leading/trailing zeros. for (e = 0; i <= nl;) x.c[e++] = +n.charAt(i++); } return x; } /* * Round Big x to a maximum of dp decimal places using rounding mode rm. * Called by stringify, P.div, P.round and P.sqrt. * * x {Big} The Big to round. * dp {number} Integer, 0 to MAX_DP inclusive. * rm {number} 0, 1, 2 or 3 (DOWN, HALF_UP, HALF_EVEN, UP) * [more] {boolean} Whether the result of division was truncated. */ function round(x, dp, rm, more) { var xc = x.c, i = x.e + dp + 1; if (i < xc.length) { if (rm === 1) { // xc[i] is the digit after the digit that may be rounded up. more = xc[i] >= 5; } else if (rm === 2) { more = xc[i] > 5 || xc[i] == 5 && (more || i < 0 || xc[i + 1] !== UNDEFINED || xc[i - 1] & 1); } else if (rm === 3) { more = more || !!xc[0]; } else { more = false; if (rm !== 0) throw Error(INVALID_RM); } if (i < 1) { xc.length = 1; if (more) { // 1, 0.1, 0.01, 0.001, 0.0001 etc. x.e = -dp; xc[0] = 1; } else { // Zero. xc[0] = x.e = 0; } } else { // Remove any digits after the required decimal places. xc.length = i--; // Round up? if (more) { // Rounding up may mean the previous digit has to be rounded up. for (; ++xc[i] > 9;) { xc[i] = 0; if (!i--) { ++x.e; xc.unshift(1); } } } // Remove trailing zeros. for (i = xc.length; !xc[--i];) xc.pop(); } } else if (rm < 0 || rm > 3 || rm !== ~~rm) { throw Error(INVALID_RM); } return x; } /* * Return a string representing the value of Big x in normal or exponential notation. * Handles P.toExponential, P.toFixed, P.toJSON, P.toPrecision, P.toString and P.valueOf. * * x {Big} * id? {number} Caller id. * 1 toExponential * 2 toFixed * 3 toPrecision * 4 valueOf * n? {number|undefined} Caller's argument. * k? {number|undefined} */ function stringify(x, id, n, k) { var e, s, Big = x.constructor, z = !x.c[0]; if (n !== UNDEFINED) { if (n !== ~~n || n < (id == 3) || n > MAX_DP) { throw Error(id == 3 ? INVALID + 'precision' : INVALID_DP); } x = new Big(x); // The index of the digit that may be rounded up. n = k - x.e; // Round? if (x.c.length > ++k) round(x, n, Big.RM); // toFixed: recalculate k as x.e may have changed if value rounded up. if (id == 2) k = x.e + n + 1; // Append zeros? for (; x.c.length < k;) x.c.push(0); } e = x.e; s = x.c.join(''); n = s.length; // Exponential notation? if (id != 2 && (id == 1 || id == 3 && k <= e || e <= Big.NE || e >= Big.PE)) { s = s.charAt(0) + (n > 1 ? '.' + s.slice(1) : '') + (e < 0 ? 'e' : 'e+') + e; // Normal notation. } else if (e < 0) { for (; ++e;) s = '0' + s; s = '0.' + s; } else if (e > 0) { if (++e > n) for (e -= n; e--;) s += '0'; else if (e < n) s = s.slice(0, e) + '.' + s.slice(e); } else if (n > 1) { s = s.charAt(0) + '.' + s.slice(1); } return x.s < 0 && (!z || id == 4) ? '-' + s : s; } // Prototype/instance methods /* * Return a new Big whose value is the absolute value of this Big. */ P.abs = function () { var x = new this.constructor(this); x.s = 1; return x; }; /* * Return 1 if the value of this Big is greater than the value of Big y, * -1 if the value of this Big is less than the value of Big y, or * 0 if they have the same value. */ P.cmp = function (y) { var isneg, x = this, xc = x.c, yc = (y = new x.constructor(y)).c, i = x.s, j = y.s, k = x.e, l = y.e; // Either zero? if (!xc[0] || !yc[0]) return !xc[0] ? !yc[0] ? 0 : -j : i; // Signs differ? if (i != j) return i; isneg = i < 0; // Compare exponents. if (k != l) return k > l ^ isneg ? 1 : -1; j = (k = xc.length) < (l = yc.length) ? k : l; // Compare digit by digit. for (i = -1; ++i < j;) { if (xc[i] != yc[i]) return xc[i] > yc[i] ^ isneg ? 1 : -1; } // Compare lengths. return k == l ? 0 : k > l ^ isneg ? 1 : -1; }; /* * Return a new Big whose value is the value of this Big divided by the value of Big y, rounded, * if necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM. */ P.div = function (y) { var x = this, Big = x.constructor, a = x.c, // dividend b = (y = new Big(y)).c, // divisor k = x.s == y.s ? 1 : -1, dp = Big.DP; if (dp !== ~~dp || dp < 0 || dp > MAX_DP) throw Error(INVALID_DP); // Divisor is zero? if (!b[0]) throw Error(DIV_BY_ZERO); // Dividend is 0? Return +-0. if (!a[0]) return new Big(k * 0); var bl, bt, n, cmp, ri, bz = b.slice(), ai = bl = b.length, al = a.length, r = a.slice(0, bl), // remainder rl = r.length, q = y, // quotient qc = q.c = [], qi = 0, d = dp + (q.e = x.e - y.e) + 1; // number of digits of the result q.s = k; k = d < 0 ? 0 : d; // Create version of divisor with leading zero. bz.unshift(0); // Add zeros to make remainder as long as divisor. for (; rl++ < bl;) r.push(0); do { // n is how many times the divisor goes into current remainder. for (n = 0; n < 10; n++) { // Compare divisor and remainder. if (bl != (rl = r.length)) { cmp = bl > rl ? 1 : -1; } else { for (ri = -1, cmp = 0; ++ri < bl;) { if (b[ri] != r[ri]) { cmp = b[ri] > r[ri] ? 1 : -1; break; } } } // If divisor < remainder, subtract divisor from remainder. if (cmp < 0) { // Remainder can't be more than 1 digit longer than divisor. // Equalise lengths using divisor with extra leading zero? for (bt = rl == bl ? b : bz; rl;) { if (r[--rl] < bt[rl]) { ri = rl; for (; ri && !r[--ri];) r[ri] = 9; --r[ri]; r[rl] += 10; } r[rl] -= bt[rl]; } for (; !r[0];) r.shift(); } else { break; } } // Add the digit n to the result array. qc[qi++] = cmp ? n : ++n; // Update the remainder. if (r[0] && cmp) r[rl] = a[ai] || 0; else r = [a[ai]]; } while ((ai++ < al || r[0] !== UNDEFINED) && k--); // Leading zero? Do not remove if result is simply zero (qi == 1). if (!qc[0] && qi != 1) { // There can't be more than one zero. qc.shift(); q.e--; } // Round? if (qi > d) round(q, dp, Big.RM, r[0] !== UNDEFINED); return q; }; /* * Return true if the value of this Big is equal to the value of Big y, otherwise return false. */ P.eq = function (y) { return !this.cmp(y); }; /* * Return true if the value of this Big is greater than the value of Big y, otherwise return * false. */ P.gt = function (y) { return this.cmp(y) > 0; }; /* * Return true if the value of this Big is greater than or equal to the value of Big y, otherwise * return false. */ P.gte = function (y) { return this.cmp(y) > -1; }; /* * Return true if the value of this Big is less than the value of Big y, otherwise return false. */ P.lt = function (y) { return this.cmp(y) < 0; }; /* * Return true if the value of this Big is less than or equal to the value of Big y, otherwise * return false. */ P.lte = function (y) { return this.cmp(y) < 1; }; /* * Return a new Big whose value is the value of this Big minus the value of Big y. */ P.minus = P.sub = function (y) { var i, j, t, xlty, x = this, Big = x.constructor, a = x.s, b = (y = new Big(y)).s; // Signs differ? if (a != b) { y.s = -b; return x.plus(y); } var xc = x.c.slice(), xe = x.e, yc = y.c, ye = y.e; // Either zero? if (!xc[0] || !yc[0]) { // y is non-zero? x is non-zero? Or both are zero. return yc[0] ? (y.s = -b, y) : new Big(xc[0] ? x : 0); } // Determine which is the bigger number. Prepend zeros to equalise exponents. if (a = xe - ye) { if (xlty = a < 0) { a = -a; t = xc; } else { ye = xe; t = yc; } t.reverse(); for (b = a; b--;) t.push(0); t.reverse(); } else { // Exponents equal. Check digit by digit. j = ((xlty = xc.length < yc.length) ? xc : yc).length; for (a = b = 0; b < j; b++) { if (xc[b] != yc[b]) { xlty = xc[b] < yc[b]; break; } } } // x < y? Point xc to the array of the bigger number. if (xlty) { t = xc; xc = yc; yc = t; y.s = -y.s; } /* * Append zeros to xc if shorter. No need to add zeros to yc if shorter as subtraction only * needs to start at yc.length. */ if ((b = (j = yc.length) - (i = xc.length)) > 0) for (; b--;) xc[i++] = 0; // Subtract yc from xc. for (b = i; j > a;) { if (xc[--j] < yc[j]) { for (i = j; i && !xc[--i];) xc[i] = 9; --xc[i]; xc[j] += 10; } xc[j] -= yc[j]; } // Remove trailing zeros. for (; xc[--b] === 0;) xc.pop(); // Remove leading zeros and adjust exponent accordingly. for (; xc[0] === 0;) { xc.shift(); --ye; } if (!xc[0]) { // n - n = +0 y.s = 1; // Result must be zero. xc = [ye = 0]; } y.c = xc; y.e = ye; return y; }; /* * Return a new Big whose value is the value of this Big modulo the value of Big y. */ P.mod = function (y) { var ygtx, x = this, Big = x.constructor, a = x.s, b = (y = new Big(y)).s; if (!y.c[0]) throw Error(DIV_BY_ZERO); x.s = y.s = 1; ygtx = y.cmp(x) == 1; x.s = a; y.s = b; if (ygtx) return new Big(x); a = Big.DP; b = Big.RM; Big.DP = Big.RM = 0; x = x.div(y); Big.DP = a; Big.RM = b; return this.minus(x.times(y)); }; /* * Return a new Big whose value is the value of this Big plus the value of Big y. */ P.plus = P.add = function (y) { var t, x = this, Big = x.constructor, a = x.s, b = (y = new Big(y)).s; // Signs differ? if (a != b) { y.s = -b; return x.minus(y); } var xe = x.e, xc = x.c, ye = y.e, yc = y.c; // Either zero? y is non-zero? x is non-zero? Or both are zero. if (!xc[0] || !yc[0]) return yc[0] ? y : new Big(xc[0] ? x : a * 0); xc = xc.slice(); // Prepend zeros to equalise exponents. // Note: reverse faster than unshifts. if (a = xe - ye) { if (a > 0) { ye = xe; t = yc; } else { a = -a; t = xc; } t.reverse(); for (; a--;) t.push(0); t.reverse(); } // Point xc to the longer array. if (xc.length - yc.length < 0) { t = yc; yc = xc; xc = t; } a = yc.length; // Only start adding at yc.length - 1 as the further digits of xc can be left as they are. for (b = 0; a; xc[a] %= 10) b = (xc[--a] = xc[a] + yc[a] + b) / 10 | 0; // No need to check for zero, as +x + +y != 0 && -x + -y != 0 if (b) { xc.unshift(b); ++ye; } // Remove trailing zeros. for (a = xc.length; xc[--a] === 0;) xc.pop(); y.c = xc; y.e = ye; return y; }; /* * Return a Big whose value is the value of this Big raised to the power n. * If n is negative, round to a maximum of Big.DP decimal places using rounding * mode Big.RM. * * n {number} Integer, -MAX_POWER to MAX_POWER inclusive. */ P.pow = function (n) { var x = this, one = new x.constructor(1), y = one, isneg = n < 0; if (n !== ~~n || n < -MAX_POWER || n > MAX_POWER) throw Error(INVALID + 'exponent'); if (isneg) n = -n; for (;;) { if (n & 1) y = y.times(x); n >>= 1; if (!n) break; x = x.times(x); } return isneg ? one.div(y) : y; }; /* * Return a new Big whose value is the value of this Big rounded using rounding mode rm * to a maximum of dp decimal places, or, if dp is negative, to an integer which is a * multiple of 10**-dp. * If dp is not specified, round to 0 decimal places. * If rm is not specified, use Big.RM. * * dp? {number} Integer, -MAX_DP to MAX_DP inclusive. * rm? 0, 1, 2 or 3 (ROUND_DOWN, ROUND_HALF_UP, ROUND_HALF_EVEN, ROUND_UP) */ P.round = function (dp, rm) { var Big = this.constructor; if (dp === UNDEFINED) dp = 0; else if (dp !== ~~dp || dp < -MAX_DP || dp > MAX_DP) throw Error(INVALID_DP); return round(new Big(this), dp, rm === UNDEFINED ? Big.RM : rm); }; /* * Return a new Big whose value is the square root of the value of this Big, rounded, if * necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM. */ P.sqrt = function () { var r, c, t, x = this, Big = x.constructor, s = x.s, e = x.e, half = new Big(0.5); // Zero? if (!x.c[0]) return new Big(x); // Negative? if (s < 0) throw Error(NAME + 'No square root'); // Estimate. s = Math.sqrt(x + ''); // Math.sqrt underflow/overflow? // Re-estimate: pass x coefficient to Math.sqrt as integer, then adjust the result exponent. if (s === 0 || s === 1 / 0) { c = x.c.join(''); if (!(c.length + e & 1)) c += '0'; s = Math.sqrt(c); e = ((e + 1) / 2 | 0) - (e < 0 || e & 1); r = new Big((s == 1 / 0 ? '1e' : (s = s.toExponential()).slice(0, s.indexOf('e') + 1)) + e); } else { r = new Big(s); } e = r.e + (Big.DP += 4); // Newton-Raphson iteration. do { t = r; r = half.times(t.plus(x.div(t))); } while (t.c.slice(0, e).join('') !== r.c.slice(0, e).join('')); return round(r, Big.DP -= 4, Big.RM); }; /* * Return a new Big whose value is the value of this Big times the value of Big y. */ P.times = P.mul = function (y) { var c, x = this, Big = x.constructor, xc = x.c, yc = (y = new Big(y)).c, a = xc.length, b = yc.length, i = x.e, j = y.e; // Determine sign of result. y.s = x.s == y.s ? 1 : -1; // Return signed 0 if either 0. if (!xc[0] || !yc[0]) return new Big(y.s * 0); // Initialise exponent of result as x.e + y.e. y.e = i + j; // If array xc has fewer digits than yc, swap xc and yc, and lengths. if (a < b) { c = xc; xc = yc; yc = c; j = a; a = b; b = j; } // Initialise coefficient array of result with zeros. for (c = new Array(j = a + b); j--;) c[j] = 0; // Multiply. // i is initially xc.length. for (i = b; i--;) { b = 0; // a is yc.length. for (j = a + i; j > i;) { // Current sum of products at this digit position, plus carry. b = c[j] + yc[i] * xc[j - i - 1] + b; c[j--] = b % 10; // carry b = b / 10 | 0; } c[j] = (c[j] + b) % 10; } // Increment result exponent if there is a final carry, otherwise remove leading zero. if (b) ++y.e; else c.shift(); // Remove trailing zeros. for (i = c.length; !c[--i];) c.pop(); y.c = c; return y; }; /* * Return a string representing the value of this Big in exponential notation to dp fixed decimal * places and rounded using Big.RM. * * dp? {number} Integer, 0 to MAX_DP inclusive. */ P.toExponential = function (dp) { return stringify(this, 1, dp, dp); }; /* * Return a string representing the value of this Big in normal notation to dp fixed decimal * places and rounded using Big.RM. * * dp? {number} Integer, 0 to MAX_DP inclusive. * * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'. * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'. */ P.toFixed = function (dp) { return stringify(this, 2, dp, this.e + dp); }; /* * Return a string representing the value of this Big rounded to sd significant digits using * Big.RM. Use exponential notation if sd is less than the number of digits necessary to represent * the integer part of the value in normal notation. * * sd {number} Integer, 1 to MAX_DP inclusive. */ P.toPrecision = function (sd) { return stringify(this, 3, sd, sd - 1); }; /* * Return a string representing the value of this Big. * Return exponential notation if this Big has a positive exponent equal to or greater than * Big.PE, or a negative exponent equal to or less than Big.NE. * Omit the sign for negative zero. */ P.toString = function () { return stringify(this); }; /* * Return a string representing the value of this Big. * Return exponential notation if this Big has a positive exponent equal to or greater than * Big.PE, or a negative exponent equal to or less than Big.NE. * Include the sign for negative zero. */ P.valueOf = P.toJSON = function () { return stringify(this, 4); }; // Export Big = _Big_(); Big['default'] = Big.Big = Big; //AMD. if (true) { !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () { return Big; }).call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); // Node and other CommonJS-like environments that support module.exports. } else {} })(this); /***/ }), /***/ 44431: /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_RESULT__;;(function (globalObject) { 'use strict'; /* * bignumber.js v9.0.2 * A JavaScript library for arbitrary-precision arithmetic. * https://github.com/MikeMcl/bignumber.js * Copyright (c) 2021 Michael Mclaughlin * MIT Licensed. * * BigNumber.prototype methods | BigNumber methods * | * absoluteValue abs | clone * comparedTo | config set * decimalPlaces dp | DECIMAL_PLACES * dividedBy div | ROUNDING_MODE * dividedToIntegerBy idiv | EXPONENTIAL_AT * exponentiatedBy pow | RANGE * integerValue | CRYPTO * isEqualTo eq | MODULO_MODE * isFinite | POW_PRECISION * isGreaterThan gt | FORMAT * isGreaterThanOrEqualTo gte | ALPHABET * isInteger | isBigNumber * isLessThan lt | maximum max * isLessThanOrEqualTo lte | minimum min * isNaN | random * isNegative | sum * isPositive | * isZero | * minus | * modulo mod | * multipliedBy times | * negated | * plus | * precision sd | * shiftedBy | * squareRoot sqrt | * toExponential | * toFixed | * toFormat | * toFraction | * toJSON | * toNumber | * toPrecision | * toString | * valueOf | * */ var BigNumber, isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, mathceil = Math.ceil, mathfloor = Math.floor, bignumberError = '[BigNumber Error] ', tooManyDigits = bignumberError + 'Number primitive has more than 15 significant digits: ', BASE = 1e14, LOG_BASE = 14, MAX_SAFE_INTEGER = 0x1fffffffffffff, // 2^53 - 1 // MAX_INT32 = 0x7fffffff, // 2^31 - 1 POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], SQRT_BASE = 1e7, // EDITABLE // The limit on the value of DECIMAL_PLACES, TO_EXP_NEG, TO_EXP_POS, MIN_EXP, MAX_EXP, and // the arguments to toExponential, toFixed, toFormat, and toPrecision. MAX = 1E9; // 0 to MAX_INT32 /* * Create and return a BigNumber constructor. */ function clone(configObject) { var div, convertBase, parseNumeric, P = BigNumber.prototype = { constructor: BigNumber, toString: null, valueOf: null }, ONE = new BigNumber(1), //----------------------------- EDITABLE CONFIG DEFAULTS ------------------------------- // The default values below must be integers within the inclusive ranges stated. // The values can also be changed at run-time using BigNumber.set. // The maximum number of decimal places for operations involving division. DECIMAL_PLACES = 20, // 0 to MAX // The rounding mode used when rounding to the above decimal places, and when using // toExponential, toFixed, toFormat and toPrecision, and round (default value). // UP 0 Away from zero. // DOWN 1 Towards zero. // CEIL 2 Towards +Infinity. // FLOOR 3 Towards -Infinity. // HALF_UP 4 Towards nearest neighbour. If equidistant, up. // HALF_DOWN 5 Towards nearest neighbour. If equidistant, down. // HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour. // HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity. // HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity. ROUNDING_MODE = 4, // 0 to 8 // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS] // The exponent value at and beneath which toString returns exponential notation. // Number type: -7 TO_EXP_NEG = -7, // 0 to -MAX // The exponent value at and above which toString returns exponential notation. // Number type: 21 TO_EXP_POS = 21, // 0 to MAX // RANGE : [MIN_EXP, MAX_EXP] // The minimum exponent value, beneath which underflow to zero occurs. // Number type: -324 (5e-324) MIN_EXP = -1e7, // -1 to -MAX // The maximum exponent value, above which overflow to Infinity occurs. // Number type: 308 (1.7976931348623157e+308) // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow. MAX_EXP = 1e7, // 1 to MAX // Whether to use cryptographically-secure random number generation, if available. CRYPTO = false, // true or false // The modulo mode used when calculating the modulus: a mod n. // The quotient (q = a / n) is calculated according to the corresponding rounding mode. // The remainder (r) is calculated as: r = a - n * q. // // UP 0 The remainder is positive if the dividend is negative, else is negative. // DOWN 1 The remainder has the same sign as the dividend. // This modulo mode is commonly known as 'truncated division' and is // equivalent to (a % n) in JavaScript. // FLOOR 3 The remainder has the same sign as the divisor (Python %). // HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function. // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). // The remainder is always positive. // // The truncated division, floored division, Euclidian division and IEEE 754 remainder // modes are commonly used for the modulus operation. // Although the other rounding modes can also be used, they may not give useful results. MODULO_MODE = 1, // 0 to 9 // The maximum number of significant digits of the result of the exponentiatedBy operation. // If POW_PRECISION is 0, there will be unlimited significant digits. POW_PRECISION = 0, // 0 to MAX // The format specification used by the BigNumber.prototype.toFormat method. FORMAT = { prefix: '', groupSize: 3, secondaryGroupSize: 0, groupSeparator: ',', decimalSeparator: '.', fractionGroupSize: 0, fractionGroupSeparator: '\xA0', // non-breaking space suffix: '' }, // The alphabet used for base conversion. It must be at least 2 characters long, with no '+', // '-', '.', whitespace, or repeated character. // '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_' ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz', alphabetHasNormalDecimalDigits = true; //------------------------------------------------------------------------------------------ // CONSTRUCTOR /* * The BigNumber constructor and exported function. * Create and return a new instance of a BigNumber object. * * v {number|string|BigNumber} A numeric value. * [b] {number} The base of v. Integer, 2 to ALPHABET.length inclusive. */ function BigNumber(v, b) { var alphabet, c, caseChanged, e, i, isNum, len, str, x = this; // Enable constructor call without `new`. if (!(x instanceof BigNumber)) return new BigNumber(v, b); if (b == null) { if (v && v._isBigNumber === true) { x.s = v.s; if (!v.c || v.e > MAX_EXP) { x.c = x.e = null; } else if (v.e < MIN_EXP) { x.c = [x.e = 0]; } else { x.e = v.e; x.c = v.c.slice(); } return; } if ((isNum = typeof v == 'number') && v * 0 == 0) { // Use `1 / n` to handle minus zero also. x.s = 1 / v < 0 ? (v = -v, -1) : 1; // Fast path for integers, where n < 2147483648 (2**31). if (v === ~~v) { for (e = 0, i = v; i >= 10; i /= 10, e++); if (e > MAX_EXP) { x.c = x.e = null; } else { x.e = e; x.c = [v]; } return; } str = String(v); } else { if (!isNumeric.test(str = String(v))) return parseNumeric(x, str, isNum); x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1; } // Decimal point? if ((e = str.indexOf('.')) > -1) str = str.replace('.', ''); // Exponential form? if ((i = str.search(/e/i)) > 0) { // Determine exponent. if (e < 0) e = i; e += +str.slice(i + 1); str = str.substring(0, i); } else if (e < 0) { // Integer. e = str.length; } } else { // '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}' intCheck(b, 2, ALPHABET.length, 'Base'); // Allow exponential notation to be used with base 10 argument, while // also rounding to DECIMAL_PLACES as with other bases. if (b == 10 && alphabetHasNormalDecimalDigits) { x = new BigNumber(v); return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE); } str = String(v); if (isNum = typeof v == 'number') { // Avoid potential interpretation of Infinity and NaN as base 44+ values. if (v * 0 != 0) return parseNumeric(x, str, isNum, b); x.s = 1 / v < 0 ? (str = str.slice(1), -1) : 1; // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}' if (BigNumber.DEBUG && str.replace(/^0\.0*|\./, '').length > 15) { throw Error (tooManyDigits + v); } } else { x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1; } alphabet = ALPHABET.slice(0, b); e = i = 0; // Check that str is a valid base b number. // Don't use RegExp, so alphabet can contain special characters. for (len = str.length; i < len; i++) { if (alphabet.indexOf(c = str.charAt(i)) < 0) { if (c == '.') { // If '.' is not the first character and it has not be found before. if (i > e) { e = len; continue; } } else if (!caseChanged) { // Allow e.g. hexadecimal 'FF' as well as 'ff'. if (str == str.toUpperCase() && (str = str.toLowerCase()) || str == str.toLowerCase() && (str = str.toUpperCase())) { caseChanged = true; i = -1; e = 0; continue; } } return parseNumeric(x, String(v), isNum, b); } } // Prevent later check for length on converted number. isNum = false; str = convertBase(str, b, 10, x.s); // Decimal point? if ((e = str.indexOf('.')) > -1) str = str.replace('.', ''); else e = str.length; } // Determine leading zeros. for (i = 0; str.charCodeAt(i) === 48; i++); // Determine trailing zeros. for (len = str.length; str.charCodeAt(--len) === 48;); if (str = str.slice(i, ++len)) { len -= i; // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}' if (isNum && BigNumber.DEBUG && len > 15 && (v > MAX_SAFE_INTEGER || v !== mathfloor(v))) { throw Error (tooManyDigits + (x.s * v)); } // Overflow? if ((e = e - i - 1) > MAX_EXP) { // Infinity. x.c = x.e = null; // Underflow? } else if (e < MIN_EXP) { // Zero. x.c = [x.e = 0]; } else { x.e = e; x.c = []; // Transform base // e is the base 10 exponent. // i is where to slice str to get the first element of the coefficient array. i = (e + 1) % LOG_BASE; if (e < 0) i += LOG_BASE; // i < 1 if (i < len) { if (i) x.c.push(+str.slice(0, i)); for (len -= LOG_BASE; i < len;) { x.c.push(+str.slice(i, i += LOG_BASE)); } i = LOG_BASE - (str = str.slice(i)).length; } else { i -= len; } for (; i--; str += '0'); x.c.push(+str); } } else { // Zero. x.c = [x.e = 0]; } } // CONSTRUCTOR PROPERTIES BigNumber.clone = clone; BigNumber.ROUND_UP = 0; BigNumber.ROUND_DOWN = 1; BigNumber.ROUND_CEIL = 2; BigNumber.ROUND_FLOOR = 3; BigNumber.ROUND_HALF_UP = 4; BigNumber.ROUND_HALF_DOWN = 5; BigNumber.ROUND_HALF_EVEN = 6; BigNumber.ROUND_HALF_CEIL = 7; BigNumber.ROUND_HALF_FLOOR = 8; BigNumber.EUCLID = 9; /* * Configure infrequently-changing library-wide settings. * * Accept an object with the following optional properties (if the value of a property is * a number, it must be an integer within the inclusive range stated): * * DECIMAL_PLACES {number} 0 to MAX * ROUNDING_MODE {number} 0 to 8 * EXPONENTIAL_AT {number|number[]} -MAX to MAX or [-MAX to 0, 0 to MAX] * RANGE {number|number[]} -MAX to MAX (not zero) or [-MAX to -1, 1 to MAX] * CRYPTO {boolean} true or false * MODULO_MODE {number} 0 to 9 * POW_PRECISION {number} 0 to MAX * ALPHABET {string} A string of two or more unique characters which does * not contain '.'. * FORMAT {object} An object with some of the following properties: * prefix {string} * groupSize {number} * secondaryGroupSize {number} * groupSeparator {string} * decimalSeparator {string} * fractionGroupSize {number} * fractionGroupSeparator {string} * suffix {string} * * (The values assigned to the above FORMAT object properties are not checked for validity.) * * E.g. * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 }) * * Ignore properties/parameters set to null or undefined, except for ALPHABET. * * Return an object with the properties current values. */ BigNumber.config = BigNumber.set = function (obj) { var p, v; if (obj != null) { if (typeof obj == 'object') { // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive. // '[BigNumber Error] DECIMAL_PLACES {not a primitive number|not an integer|out of range}: {v}' if (obj.hasOwnProperty(p = 'DECIMAL_PLACES')) { v = obj[p]; intCheck(v, 0, MAX, p); DECIMAL_PLACES = v; } // ROUNDING_MODE {number} Integer, 0 to 8 inclusive. // '[BigNumber Error] ROUNDING_MODE {not a primitive number|not an integer|out of range}: {v}' if (obj.hasOwnProperty(p = 'ROUNDING_MODE')) { v = obj[p]; intCheck(v, 0, 8, p); ROUNDING_MODE = v; } // EXPONENTIAL_AT {number|number[]} // Integer, -MAX to MAX inclusive or // [integer -MAX to 0 inclusive, 0 to MAX inclusive]. // '[BigNumber Error] EXPONENTIAL_AT {not a primitive number|not an integer|out of range}: {v}' if (obj.hasOwnProperty(p = 'EXPONENTIAL_AT')) { v = obj[p]; if (v && v.pop) { intCheck(v[0], -MAX, 0, p); intCheck(v[1], 0, MAX, p); TO_EXP_NEG = v[0]; TO_EXP_POS = v[1]; } else { intCheck(v, -MAX, MAX, p); TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v); } } // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive]. // '[BigNumber Error] RANGE {not a primitive number|not an integer|out of range|cannot be zero}: {v}' if (obj.hasOwnProperty(p = 'RANGE')) { v = obj[p]; if (v && v.pop) { intCheck(v[0], -MAX, -1, p); intCheck(v[1], 1, MAX, p); MIN_EXP = v[0]; MAX_EXP = v[1]; } else { intCheck(v, -MAX, MAX, p); if (v) { MIN_EXP = -(MAX_EXP = v < 0 ? -v : v); } else { throw Error (bignumberError + p + ' cannot be zero: ' + v); } } } // CRYPTO {boolean} true or false. // '[BigNumber Error] CRYPTO not true or false: {v}' // '[BigNumber Error] crypto unavailable' if (obj.hasOwnProperty(p = 'CRYPTO')) { v = obj[p]; if (v === !!v) { if (v) { if (typeof crypto != 'undefined' && crypto && (crypto.getRandomValues || crypto.randomBytes)) { CRYPTO = v; } else { CRYPTO = !v; throw Error (bignumberError + 'crypto unavailable'); } } else { CRYPTO = v; } } else { throw Error (bignumberError + p + ' not true or false: ' + v); } } // MODULO_MODE {number} Integer, 0 to 9 inclusive. // '[BigNumber Error] MODULO_MODE {not a primitive number|not an integer|out of range}: {v}' if (obj.hasOwnProperty(p = 'MODULO_MODE')) { v = obj[p]; intCheck(v, 0, 9, p); MODULO_MODE = v; } // POW_PRECISION {number} Integer, 0 to MAX inclusive. // '[BigNumber Error] POW_PRECISION {not a primitive number|not an integer|out of range}: {v}' if (obj.hasOwnProperty(p = 'POW_PRECISION')) { v = obj[p]; intCheck(v, 0, MAX, p); POW_PRECISION = v; } // FORMAT {object} // '[BigNumber Error] FORMAT not an object: {v}' if (obj.hasOwnProperty(p = 'FORMAT')) { v = obj[p]; if (typeof v == 'object') FORMAT = v; else throw Error (bignumberError + p + ' not an object: ' + v); } // ALPHABET {string} // '[BigNumber Error] ALPHABET invalid: {v}' if (obj.hasOwnProperty(p = 'ALPHABET')) { v = obj[p]; // Disallow if less than two characters, // or if it contains '+', '-', '.', whitespace, or a repeated character. if (typeof v == 'string' && !/^.?$|[+\-.\s]|(.).*\1/.test(v)) { alphabetHasNormalDecimalDigits = v.slice(0, 10) == '0123456789'; ALPHABET = v; } else { throw Error (bignumberError + p + ' invalid: ' + v); } } } else { // '[BigNumber Error] Object expected: {v}' throw Error (bignumberError + 'Object expected: ' + obj); } } return { DECIMAL_PLACES: DECIMAL_PLACES, ROUNDING_MODE: ROUNDING_MODE, EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS], RANGE: [MIN_EXP, MAX_EXP], CRYPTO: CRYPTO, MODULO_MODE: MODULO_MODE, POW_PRECISION: POW_PRECISION, FORMAT: FORMAT, ALPHABET: ALPHABET }; }; /* * Return true if v is a BigNumber instance, otherwise return false. * * If BigNumber.DEBUG is true, throw if a BigNumber instance is not well-formed. * * v {any} * * '[BigNumber Error] Invalid BigNumber: {v}' */ BigNumber.isBigNumber = function (v) { if (!v || v._isBigNumber !== true) return false; if (!BigNumber.DEBUG) return true; var i, n, c = v.c, e = v.e, s = v.s; out: if ({}.toString.call(c) == '[object Array]') { if ((s === 1 || s === -1) && e >= -MAX && e <= MAX && e === mathfloor(e)) { // If the first element is zero, the BigNumber value must be zero. if (c[0] === 0) { if (e === 0 && c.length === 1) return true; break out; } // Calculate number of digits that c[0] should have, based on the exponent. i = (e + 1) % LOG_BASE; if (i < 1) i += LOG_BASE; // Calculate number of digits of c[0]. //if (Math.ceil(Math.log(c[0] + 1) / Math.LN10) == i) { if (String(c[0]).length == i) { for (i = 0; i < c.length; i++) { n = c[i]; if (n < 0 || n >= BASE || n !== mathfloor(n)) break out; } // Last element cannot be zero, unless it is the only element. if (n !== 0) return true; } } // Infinity/NaN } else if (c === null && e === null && (s === null || s === 1 || s === -1)) { return true; } throw Error (bignumberError + 'Invalid BigNumber: ' + v); }; /* * Return a new BigNumber whose value is the maximum of the arguments. * * arguments {number|string|BigNumber} */ BigNumber.maximum = BigNumber.max = function () { return maxOrMin(arguments, P.lt); }; /* * Return a new BigNumber whose value is the minimum of the arguments. * * arguments {number|string|BigNumber} */ BigNumber.minimum = BigNumber.min = function () { return maxOrMin(arguments, P.gt); }; /* * Return a new BigNumber with a random value equal to or greater than 0 and less than 1, * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing * zeros are produced). * * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. * * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp}' * '[BigNumber Error] crypto unavailable' */ BigNumber.random = (function () { var pow2_53 = 0x20000000000000; // Return a 53 bit integer n, where 0 <= n < 9007199254740992. // Check if Math.random() produces more than 32 bits of randomness. // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits. // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1. var random53bitInt = (Math.random() * pow2_53) & 0x1fffff ? function () { return mathfloor(Math.random() * pow2_53); } : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) + (Math.random() * 0x800000 | 0); }; return function (dp) { var a, b, e, k, v, i = 0, c = [], rand = new BigNumber(ONE); if (dp == null) dp = DECIMAL_PLACES; else intCheck(dp, 0, MAX); k = mathceil(dp / LOG_BASE); if (CRYPTO) { // Browsers supporting crypto.getRandomValues. if (crypto.getRandomValues) { a = crypto.getRandomValues(new Uint32Array(k *= 2)); for (; i < k;) { // 53 bits: // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2) // 11111 11111111 11111111 11111111 11100000 00000000 00000000 // ((Math.pow(2, 32) - 1) >>> 11).toString(2) // 11111 11111111 11111111 // 0x20000 is 2^21. v = a[i] * 0x20000 + (a[i + 1] >>> 11); // Rejection sampling: // 0 <= v < 9007199254740992 // Probability that v >= 9e15, is // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251 if (v >= 9e15) { b = crypto.getRandomValues(new Uint32Array(2)); a[i] = b[0]; a[i + 1] = b[1]; } else { // 0 <= v <= 8999999999999999 // 0 <= (v % 1e14) <= 99999999999999 c.push(v % 1e14); i += 2; } } i = k / 2; // Node.js supporting crypto.randomBytes. } else if (crypto.randomBytes) { // buffer a = crypto.randomBytes(k *= 7); for (; i < k;) { // 0x1000000000000 is 2^48, 0x10000000000 is 2^40 // 0x100000000 is 2^32, 0x1000000 is 2^24 // 11111 11111111 11111111 11111111 11111111 11111111 11111111 // 0 <= v < 9007199254740992 v = ((a[i] & 31) * 0x1000000000000) + (a[i + 1] * 0x10000000000) + (a[i + 2] * 0x100000000) + (a[i + 3] * 0x1000000) + (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6]; if (v >= 9e15) { crypto.randomBytes(7).copy(a, i); } else { // 0 <= (v % 1e14) <= 99999999999999 c.push(v % 1e14); i += 7; } } i = k / 7; } else { CRYPTO = false; throw Error (bignumberError + 'crypto unavailable'); } } // Use Math.random. if (!CRYPTO) { for (; i < k;) { v = random53bitInt(); if (v < 9e15) c[i++] = v % 1e14; } } k = c[--i]; dp %= LOG_BASE; // Convert trailing digits to zeros according to dp. if (k && dp) { v = POWS_TEN[LOG_BASE - dp]; c[i] = mathfloor(k / v) * v; } // Remove trailing elements which are zero. for (; c[i] === 0; c.pop(), i--); // Zero? if (i < 0) { c = [e = 0]; } else { // Remove leading elements which are zero and adjust exponent accordingly. for (e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE); // Count the digits of the first element of c to determine leading zeros, and... for (i = 1, v = c[0]; v >= 10; v /= 10, i++); // adjust the exponent accordingly. if (i < LOG_BASE) e -= LOG_BASE - i; } rand.e = e; rand.c = c; return rand; }; })(); /* * Return a BigNumber whose value is the sum of the arguments. * * arguments {number|string|BigNumber} */ BigNumber.sum = function () { var i = 1, args = arguments, sum = new BigNumber(args[0]); for (; i < args.length;) sum = sum.plus(args[i++]); return sum; }; // PRIVATE FUNCTIONS // Called by BigNumber and BigNumber.prototype.toString. convertBase = (function () { var decimal = '0123456789'; /* * Convert string of baseIn to an array of numbers of baseOut. * Eg. toBaseOut('255', 10, 16) returns [15, 15]. * Eg. toBaseOut('ff', 16, 10) returns [2, 5, 5]. */ function toBaseOut(str, baseIn, baseOut, alphabet) { var j, arr = [0], arrL, i = 0, len = str.length; for (; i < len;) { for (arrL = arr.length; arrL--; arr[arrL] *= baseIn); arr[0] += alphabet.indexOf(str.charAt(i++)); for (j = 0; j < arr.length; j++) { if (arr[j] > baseOut - 1) { if (arr[j + 1] == null) arr[j + 1] = 0; arr[j + 1] += arr[j] / baseOut | 0; arr[j] %= baseOut; } } } return arr.reverse(); } // Convert a numeric string of baseIn to a numeric string of baseOut. // If the caller is toString, we are converting from base 10 to baseOut. // If the caller is BigNumber, we are converting from baseIn to base 10. return function (str, baseIn, baseOut, sign, callerIsToString) { var alphabet, d, e, k, r, x, xc, y, i = str.indexOf('.'), dp = DECIMAL_PLACES, rm = ROUNDING_MODE; // Non-integer. if (i >= 0) { k = POW_PRECISION; // Unlimited precision. POW_PRECISION = 0; str = str.replace('.', ''); y = new BigNumber(baseIn); x = y.pow(str.length - i); POW_PRECISION = k; // Convert str as if an integer, then restore the fraction part by dividing the // result by its base raised to a power. y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e, '0'), 10, baseOut, decimal); y.e = y.c.length; } // Convert the number as integer. xc = toBaseOut(str, baseIn, baseOut, callerIsToString ? (alphabet = ALPHABET, decimal) : (alphabet = decimal, ALPHABET)); // xc now represents str as an integer and converted to baseOut. e is the exponent. e = k = xc.length; // Remove trailing zeros. for (; xc[--k] == 0; xc.pop()); // Zero? if (!xc[0]) return alphabet.charAt(0); // Does str represent an integer? If so, no need for the division. if (i < 0) { --e; } else { x.c = xc; x.e = e; // The sign is needed for correct rounding. x.s = sign; x = div(x, y, dp, rm, baseOut); xc = x.c; r = x.r; e = x.e; } // xc now represents str converted to baseOut. // THe index of the rounding digit. d = e + dp + 1; // The rounding digit: the digit to the right of the digit that may be rounded up. i = xc[d]; // Look at the rounding digits and mode to determine whether to round up. k = baseOut / 2; r = r || d < 0 || xc[d + 1] != null; r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : i > k || i == k &&(rm == 4 || r || rm == 6 && xc[d - 1] & 1 || rm == (x.s < 0 ? 8 : 7)); // If the index of the rounding digit is not greater than zero, or xc represents // zero, then the result of the base conversion is zero or, if rounding up, a value // such as 0.00001. if (d < 1 || !xc[0]) { // 1^-dp or 0 str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0); } else { // Truncate xc to the required number of decimal places. xc.length = d; // Round up? if (r) { // Rounding up may mean the previous digit has to be rounded up and so on. for (--baseOut; ++xc[--d] > baseOut;) { xc[d] = 0; if (!d) { ++e; xc = [1].concat(xc); } } } // Determine trailing zeros. for (k = xc.length; !xc[--k];); // E.g. [4, 11, 15] becomes 4bf. for (i = 0, str = ''; i <= k; str += alphabet.charAt(xc[i++])); // Add leading zeros, decimal point and trailing zeros as required. str = toFixedPoint(str, e, alphabet.charAt(0)); } // The caller will add the sign. return str; }; })(); // Perform division in the specified base. Called by div and convertBase. div = (function () { // Assume non-zero x and k. function multiply(x, k, base) { var m, temp, xlo, xhi, carry = 0, i = x.length, klo = k % SQRT_BASE, khi = k / SQRT_BASE | 0; for (x = x.slice(); i--;) { xlo = x[i] % SQRT_BASE; xhi = x[i] / SQRT_BASE | 0; m = khi * xlo + xhi * klo; temp = klo * xlo + ((m % SQRT_BASE) * SQRT_BASE) + carry; carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi; x[i] = temp % base; } if (carry) x = [carry].concat(x); return x; } function compare(a, b, aL, bL) { var i, cmp; if (aL != bL) { cmp = aL > bL ? 1 : -1; } else { for (i = cmp = 0; i < aL; i++) { if (a[i] != b[i]) { cmp = a[i] > b[i] ? 1 : -1; break; } } } return cmp; } function subtract(a, b, aL, base) { var i = 0; // Subtract b from a. for (; aL--;) { a[aL] -= i; i = a[aL] < b[aL] ? 1 : 0; a[aL] = i * base + a[aL] - b[aL]; } // Remove leading zeros. for (; !a[0] && a.length > 1; a.splice(0, 1)); } // x: dividend, y: divisor. return function (x, y, dp, rm, base) { var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0, yL, yz, s = x.s == y.s ? 1 : -1, xc = x.c, yc = y.c; // Either NaN, Infinity or 0? if (!xc || !xc[0] || !yc || !yc[0]) { return new BigNumber( // Return NaN if either NaN, or both Infinity or 0. !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN : // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0. xc && xc[0] == 0 || !yc ? s * 0 : s / 0 ); } q = new BigNumber(s); qc = q.c = []; e = x.e - y.e; s = dp + e + 1; if (!base) { base = BASE; e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE); s = s / LOG_BASE | 0; } // Result exponent may be one less then the current value of e. // The coefficients of the BigNumbers from convertBase may have trailing zeros. for (i = 0; yc[i] == (xc[i] || 0); i++); if (yc[i] > (xc[i] || 0)) e--; if (s < 0) { qc.push(1); more = true; } else { xL = xc.length; yL = yc.length; i = 0; s += 2; // Normalise xc and yc so highest order digit of yc is >= base / 2. n = mathfloor(base / (yc[0] + 1)); // Not necessary, but to handle odd bases where yc[0] == (base / 2) - 1. // if (n > 1 || n++ == 1 && yc[0] < base / 2) { if (n > 1) { yc = multiply(yc, n, base); xc = multiply(xc, n, base); yL = yc.length; xL = xc.length; } xi = yL; rem = xc.slice(0, yL); remL = rem.length; // Add zeros to make remainder as long as divisor. for (; remL < yL; rem[remL++] = 0); yz = yc.slice(); yz = [0].concat(yz); yc0 = yc[0]; if (yc[1] >= base / 2) yc0++; // Not necessary, but to prevent trial digit n > base, when using base 3. // else if (base == 3 && yc0 == 1) yc0 = 1 + 1e-15; do { n = 0; // Compare divisor and remainder. cmp = compare(yc, rem, yL, remL); // If divisor < remainder. if (cmp < 0) { // Calculate trial digit, n. rem0 = rem[0]; if (yL != remL) rem0 = rem0 * base + (rem[1] || 0); // n is how many times the divisor goes into the current remainder. n = mathfloor(rem0 / yc0); // Algorithm: // product = divisor multiplied by trial digit (n). // Compare product and remainder. // If product is greater than remainder: // Subtract divisor from product, decrement trial digit. // Subtract product from remainder. // If product was less than remainder at the last compare: // Compare new remainder and divisor. // If remainder is greater than divisor: // Subtract divisor from remainder, increment trial digit. if (n > 1) { // n may be > base only when base is 3. if (n >= base) n = base - 1; // product = divisor * trial digit. prod = multiply(yc, n, base); prodL = prod.length; remL = rem.length; // Compare product and remainder. // If product > remainder then trial digit n too high. // n is 1 too high about 5% of the time, and is not known to have // ever been more than 1 too high. while (compare(prod, rem, prodL, remL) == 1) { n--; // Subtract divisor from product. subtract(prod, yL < prodL ? yz : yc, prodL, base); prodL = prod.length; cmp = 1; } } else { // n is 0 or 1, cmp is -1. // If n is 0, there is no need to compare yc and rem again below, // so change cmp to 1 to avoid it. // If n is 1, leave cmp as -1, so yc and rem are compared again. if (n == 0) { // divisor < remainder, so n must be at least 1. cmp = n = 1; } // product = divisor prod = yc.slice(); prodL = prod.length; } if (prodL < remL) prod = [0].concat(prod); // Subtract product from remainder. subtract(rem, prod, remL, base); remL = rem.length; // If product was < remainder. if (cmp == -1) { // Compare divisor and new remainder. // If divisor < new remainder, subtract divisor from remainder. // Trial digit n too low. // n is 1 too low about 5% of the time, and very rarely 2 too low. while (compare(yc, rem, yL, remL) < 1) { n++; // Subtract divisor from remainder. subtract(rem, yL < remL ? yz : yc, remL, base); remL = rem.length; } } } else if (cmp === 0) { n++; rem = [0]; } // else cmp === 1 and n will be 0 // Add the next digit, n, to the result array. qc[i++] = n; // Update the remainder. if (rem[0]) { rem[remL++] = xc[xi] || 0; } else { rem = [xc[xi]]; remL = 1; } } while ((xi++ < xL || rem[0] != null) && s--); more = rem[0] != null; // Leading zero? if (!qc[0]) qc.splice(0, 1); } if (base == BASE) { // To calculate q.e, first get the number of digits of qc[0]. for (i = 1, s = qc[0]; s >= 10; s /= 10, i++); round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more); // Caller is convertBase. } else { q.e = e; q.r = +more; } return q; }; })(); /* * Return a string representing the value of BigNumber n in fixed-point or exponential * notation rounded to the specified decimal places or significant digits. * * n: a BigNumber. * i: the index of the last digit required (i.e. the digit that may be rounded up). * rm: the rounding mode. * id: 1 (toExponential) or 2 (toPrecision). */ function format(n, i, rm, id) { var c0, e, ne, len, str; if (rm == null) rm = ROUNDING_MODE; else intCheck(rm, 0, 8); if (!n.c) return n.toString(); c0 = n.c[0]; ne = n.e; if (i == null) { str = coeffToString(n.c); str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS) ? toExponential(str, ne) : toFixedPoint(str, ne, '0'); } else { n = round(new BigNumber(n), i, rm); // n.e may have changed if the value was rounded up. e = n.e; str = coeffToString(n.c); len = str.length; // toPrecision returns exponential notation if the number of significant digits // specified is less than the number of digits necessary to represent the integer // part of the value in fixed-point notation. // Exponential notation. if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) { // Append zeros? for (; len < i; str += '0', len++); str = toExponential(str, e); // Fixed-point notation. } else { i -= ne; str = toFixedPoint(str, e, '0'); // Append zeros? if (e + 1 > len) { if (--i > 0) for (str += '.'; i--; str += '0'); } else { i += e - len; if (i > 0) { if (e + 1 == len) str += '.'; for (; i--; str += '0'); } } } } return n.s < 0 && c0 ? '-' + str : str; } // Handle BigNumber.max and BigNumber.min. function maxOrMin(args, method) { var n, i = 1, m = new BigNumber(args[0]); for (; i < args.length; i++) { n = new BigNumber(args[i]); // If any number is NaN, return NaN. if (!n.s) { m = n; break; } else if (method.call(m, n)) { m = n; } } return m; } /* * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP. * Called by minus, plus and times. */ function normalise(n, c, e) { var i = 1, j = c.length; // Remove trailing zeros. for (; !c[--j]; c.pop()); // Calculate the base 10 exponent. First get the number of digits of c[0]. for (j = c[0]; j >= 10; j /= 10, i++); // Overflow? if ((e = i + e * LOG_BASE - 1) > MAX_EXP) { // Infinity. n.c = n.e = null; // Underflow? } else if (e < MIN_EXP) { // Zero. n.c = [n.e = 0]; } else { n.e = e; n.c = c; } return n; } // Handle values that fail the validity test in BigNumber. parseNumeric = (function () { var basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i, dotAfter = /^([^.]+)\.$/, dotBefore = /^\.([^.]+)$/, isInfinityOrNaN = /^-?(Infinity|NaN)$/, whitespaceOrPlus = /^\s*\+(?=[\w.])|^\s+|\s+$/g; return function (x, str, isNum, b) { var base, s = isNum ? str : str.replace(whitespaceOrPlus, ''); // No exception on ±Infinity or NaN. if (isInfinityOrNaN.test(s)) { x.s = isNaN(s) ? null : s < 0 ? -1 : 1; } else { if (!isNum) { // basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i s = s.replace(basePrefix, function (m, p1, p2) { base = (p2 = p2.toLowerCase()) == 'x' ? 16 : p2 == 'b' ? 2 : 8; return !b || b == base ? p1 : m; }); if (b) { base = b; // E.g. '1.' to '1', '.1' to '0.1' s = s.replace(dotAfter, '$1').replace(dotBefore, '0.$1'); } if (str != s) return new BigNumber(s, base); } // '[BigNumber Error] Not a number: {n}' // '[BigNumber Error] Not a base {b} number: {n}' if (BigNumber.DEBUG) { throw Error (bignumberError + 'Not a' + (b ? ' base ' + b : '') + ' number: ' + str); } // NaN x.s = null; } x.c = x.e = null; } })(); /* * Round x to sd significant digits using rounding mode rm. Check for over/under-flow. * If r is truthy, it is known that there are more digits after the rounding digit. */ function round(x, sd, rm, r) { var d, i, j, k, n, ni, rd, xc = x.c, pows10 = POWS_TEN; // if x is not Infinity or NaN... if (xc) { // rd is the rounding digit, i.e. the digit after the digit that may be rounded up. // n is a base 1e14 number, the value of the element of array x.c containing rd. // ni is the index of n within x.c. // d is the number of digits of n. // i is the index of rd within n including leading zeros. // j is the actual index of rd within n (if < 0, rd is a leading zero). out: { // Get the number of digits of the first element of xc. for (d = 1, k = xc[0]; k >= 10; k /= 10, d++); i = sd - d; // If the rounding digit is in the first element of xc... if (i < 0) { i += LOG_BASE; j = sd; n = xc[ni = 0]; // Get the rounding digit at index j of n. rd = n / pows10[d - j - 1] % 10 | 0; } else { ni = mathceil((i + 1) / LOG_BASE); if (ni >= xc.length) { if (r) { // Needed by sqrt. for (; xc.length <= ni; xc.push(0)); n = rd = 0; d = 1; i %= LOG_BASE; j = i - LOG_BASE + 1; } else { break out; } } else { n = k = xc[ni]; // Get the number of digits of n. for (d = 1; k >= 10; k /= 10, d++); // Get the index of rd within n. i %= LOG_BASE; // Get the index of rd within n, adjusted for leading zeros. // The number of leading zeros of n is given by LOG_BASE - d. j = i - LOG_BASE + d; // Get the rounding digit at index j of n. rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0; } } r = r || sd < 0 || // Are there any non-zero digits after the rounding digit? // The expression n % pows10[d - j - 1] returns all digits of n to the right // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714. xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]); r = rm < 4 ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 && // Check whether the digit to the left of the rounding digit is odd. ((i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10) & 1 || rm == (x.s < 0 ? 8 : 7)); if (sd < 1 || !xc[0]) { xc.length = 0; if (r) { // Convert sd to decimal places. sd -= x.e + 1; // 1, 0.1, 0.01, 0.001, 0.0001 etc. xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE]; x.e = -sd || 0; } else { // Zero. xc[0] = x.e = 0; } return x; } // Remove excess digits. if (i == 0) { xc.length = ni; k = 1; ni--; } else { xc.length = ni + 1; k = pows10[LOG_BASE - i]; // E.g. 56700 becomes 56000 if 7 is the rounding digit. // j > 0 means i > number of leading zeros of n. xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0; } // Round up? if (r) { for (; ;) { // If the digit to be rounded up is in the first element of xc... if (ni == 0) { // i will be the length of xc[0] before k is added. for (i = 1, j = xc[0]; j >= 10; j /= 10, i++); j = xc[0] += k; for (k = 1; j >= 10; j /= 10, k++); // if i != k the length has increased. if (i != k) { x.e++; if (xc[0] == BASE) xc[0] = 1; } break; } else { xc[ni] += k; if (xc[ni] != BASE) break; xc[ni--] = 0; k = 1; } } } // Remove trailing zeros. for (i = xc.length; xc[--i] === 0; xc.pop()); } // Overflow? Infinity. if (x.e > MAX_EXP) { x.c = x.e = null; // Underflow? Zero. } else if (x.e < MIN_EXP) { x.c = [x.e = 0]; } } return x; } function valueOf(n) { var str, e = n.e; if (e === null) return n.toString(); str = coeffToString(n.c); str = e <= TO_EXP_NEG || e >= TO_EXP_POS ? toExponential(str, e) : toFixedPoint(str, e, '0'); return n.s < 0 ? '-' + str : str; } // PROTOTYPE/INSTANCE METHODS /* * Return a new BigNumber whose value is the absolute value of this BigNumber. */ P.absoluteValue = P.abs = function () { var x = new BigNumber(this); if (x.s < 0) x.s = 1; return x; }; /* * Return * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b), * -1 if the value of this BigNumber is less than the value of BigNumber(y, b), * 0 if they have the same value, * or null if the value of either is NaN. */ P.comparedTo = function (y, b) { return compare(this, new BigNumber(y, b)); }; /* * If dp is undefined or null or true or false, return the number of decimal places of the * value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN. * * Otherwise, if dp is a number, return a new BigNumber whose value is the value of this * BigNumber rounded to a maximum of dp decimal places using rounding mode rm, or * ROUNDING_MODE if rm is omitted. * * [dp] {number} Decimal places: integer, 0 to MAX inclusive. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. * * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}' */ P.decimalPlaces = P.dp = function (dp, rm) { var c, n, v, x = this; if (dp != null) { intCheck(dp, 0, MAX); if (rm == null) rm = ROUNDING_MODE; else intCheck(rm, 0, 8); return round(new BigNumber(x), dp + x.e + 1, rm); } if (!(c = x.c)) return null; n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE; // Subtract the number of trailing zeros of the last number. if (v = c[v]) for (; v % 10 == 0; v /= 10, n--); if (n < 0) n = 0; return n; }; /* * n / 0 = I * n / N = N * n / I = 0 * 0 / n = 0 * 0 / 0 = N * 0 / N = N * 0 / I = 0 * N / n = N * N / 0 = N * N / N = N * N / I = N * I / n = I * I / 0 = I * I / N = N * I / I = N * * Return a new BigNumber whose value is the value of this BigNumber divided by the value of * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE. */ P.dividedBy = P.div = function (y, b) { return div(this, new BigNumber(y, b), DECIMAL_PLACES, ROUNDING_MODE); }; /* * Return a new BigNumber whose value is the integer part of dividing the value of this * BigNumber by the value of BigNumber(y, b). */ P.dividedToIntegerBy = P.idiv = function (y, b) { return div(this, new BigNumber(y, b), 0, 1); }; /* * Return a BigNumber whose value is the value of this BigNumber exponentiated by n. * * If m is present, return the result modulo m. * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE. * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using ROUNDING_MODE. * * The modular power operation works efficiently when x, n, and m are integers, otherwise it * is equivalent to calculating x.exponentiatedBy(n).modulo(m) with a POW_PRECISION of 0. * * n {number|string|BigNumber} The exponent. An integer. * [m] {number|string|BigNumber} The modulus. * * '[BigNumber Error] Exponent not an integer: {n}' */ P.exponentiatedBy = P.pow = function (n, m) { var half, isModExp, i, k, more, nIsBig, nIsNeg, nIsOdd, y, x = this; n = new BigNumber(n); // Allow NaN and ±Infinity, but not other non-integers. if (n.c && !n.isInteger()) { throw Error (bignumberError + 'Exponent not an integer: ' + valueOf(n)); } if (m != null) m = new BigNumber(m); // Exponent of MAX_SAFE_INTEGER is 15. nIsBig = n.e > 14; // If x is NaN, ±Infinity, ±0 or ±1, or n is ±Infinity, NaN or ±0. if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) { // The sign of the result of pow when x is negative depends on the evenness of n. // If +n overflows to ±Infinity, the evenness of n would be not be known. y = new BigNumber(Math.pow(+valueOf(x), nIsBig ? 2 - isOdd(n) : +valueOf(n))); return m ? y.mod(m) : y; } nIsNeg = n.s < 0; if (m) { // x % m returns NaN if abs(m) is zero, or m is NaN. if (m.c ? !m.c[0] : !m.s) return new BigNumber(NaN); isModExp = !nIsNeg && x.isInteger() && m.isInteger(); if (isModExp) x = x.mod(m); // Overflow to ±Infinity: >=2**1e10 or >=1.0000024**1e15. // Underflow to ±0: <=0.79**1e10 or <=0.9999975**1e15. } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0 // [1, 240000000] ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7 // [80000000000000] [99999750000000] : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) { // If x is negative and n is odd, k = -0, else k = 0. k = x.s < 0 && isOdd(n) ? -0 : 0; // If x >= 1, k = ±Infinity. if (x.e > -1) k = 1 / k; // If n is negative return ±0, else return ±Infinity. return new BigNumber(nIsNeg ? 1 / k : k); } else if (POW_PRECISION) { // Truncating each coefficient array to a length of k after each multiplication // equates to truncating significant digits to POW_PRECISION + [28, 41], // i.e. there will be a minimum of 28 guard digits retained. k = mathceil(POW_PRECISION / LOG_BASE + 2); } if (nIsBig) { half = new BigNumber(0.5); if (nIsNeg) n.s = 1; nIsOdd = isOdd(n); } else { i = Math.abs(+valueOf(n)); nIsOdd = i % 2; } y = new BigNumber(ONE); // Performs 54 loop iterations for n of 9007199254740991. for (; ;) { if (nIsOdd) { y = y.times(x); if (!y.c) break; if (k) { if (y.c.length > k) y.c.length = k; } else if (isModExp) { y = y.mod(m); //y = y.minus(div(y, m, 0, MODULO_MODE).times(m)); } } if (i) { i = mathfloor(i / 2); if (i === 0) break; nIsOdd = i % 2; } else { n = n.times(half); round(n, n.e + 1, 1); if (n.e > 14) { nIsOdd = isOdd(n); } else { i = +valueOf(n); if (i === 0) break; nIsOdd = i % 2; } } x = x.times(x); if (k) { if (x.c && x.c.length > k) x.c.length = k; } else if (isModExp) { x = x.mod(m); //x = x.minus(div(x, m, 0, MODULO_MODE).times(m)); } } if (isModExp) return y; if (nIsNeg) y = ONE.div(y); return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y; }; /* * Return a new BigNumber whose value is the value of this BigNumber rounded to an integer * using rounding mode rm, or ROUNDING_MODE if rm is omitted. * * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. * * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {rm}' */ P.integerValue = function (rm) { var n = new BigNumber(this); if (rm == null) rm = ROUNDING_MODE; else intCheck(rm, 0, 8); return round(n, n.e + 1, rm); }; /* * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b), * otherwise return false. */ P.isEqualTo = P.eq = function (y, b) { return compare(this, new BigNumber(y, b)) === 0; }; /* * Return true if the value of this BigNumber is a finite number, otherwise return false. */ P.isFinite = function () { return !!this.c; }; /* * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b), * otherwise return false. */ P.isGreaterThan = P.gt = function (y, b) { return compare(this, new BigNumber(y, b)) > 0; }; /* * Return true if the value of this BigNumber is greater than or equal to the value of * BigNumber(y, b), otherwise return false. */ P.isGreaterThanOrEqualTo = P.gte = function (y, b) { return (b = compare(this, new BigNumber(y, b))) === 1 || b === 0; }; /* * Return true if the value of this BigNumber is an integer, otherwise return false. */ P.isInteger = function () { return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2; }; /* * Return true if the value of this BigNumber is less than the value of BigNumber(y, b), * otherwise return false. */ P.isLessThan = P.lt = function (y, b) { return compare(this, new BigNumber(y, b)) < 0; }; /* * Return true if the value of this BigNumber is less than or equal to the value of * BigNumber(y, b), otherwise return false. */ P.isLessThanOrEqualTo = P.lte = function (y, b) { return (b = compare(this, new BigNumber(y, b))) === -1 || b === 0; }; /* * Return true if the value of this BigNumber is NaN, otherwise return false. */ P.isNaN = function () { return !this.s; }; /* * Return true if the value of this BigNumber is negative, otherwise return false. */ P.isNegative = function () { return this.s < 0; }; /* * Return true if the value of this BigNumber is positive, otherwise return false. */ P.isPositive = function () { return this.s > 0; }; /* * Return true if the value of this BigNumber is 0 or -0, otherwise return false. */ P.isZero = function () { return !!this.c && this.c[0] == 0; }; /* * n - 0 = n * n - N = N * n - I = -I * 0 - n = -n * 0 - 0 = 0 * 0 - N = N * 0 - I = -I * N - n = N * N - 0 = N * N - N = N * N - I = N * I - n = I * I - 0 = I * I - N = N * I - I = N * * Return a new BigNumber whose value is the value of this BigNumber minus the value of * BigNumber(y, b). */ P.minus = function (y, b) { var i, j, t, xLTy, x = this, a = x.s; y = new BigNumber(y, b); b = y.s; // Either NaN? if (!a || !b) return new BigNumber(NaN); // Signs differ? if (a != b) { y.s = -b; return x.plus(y); } var xe = x.e / LOG_BASE, ye = y.e / LOG_BASE, xc = x.c, yc = y.c; if (!xe || !ye) { // Either Infinity? if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber(yc ? x : NaN); // Either zero? if (!xc[0] || !yc[0]) { // Return y if y is non-zero, x if x is non-zero, or zero if both are zero. return yc[0] ? (y.s = -b, y) : new BigNumber(xc[0] ? x : // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity ROUNDING_MODE == 3 ? -0 : 0); } } xe = bitFloor(xe); ye = bitFloor(ye); xc = xc.slice(); // Determine which is the bigger number. if (a = xe - ye) { if (xLTy = a < 0) { a = -a; t = xc; } else { ye = xe; t = yc; } t.reverse(); // Prepend zeros to equalise exponents. for (b = a; b--; t.push(0)); t.reverse(); } else { // Exponents equal. Check digit by digit. j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b; for (a = b = 0; b < j; b++) { if (xc[b] != yc[b]) { xLTy = xc[b] < yc[b]; break; } } } // x < y? Point xc to the array of the bigger number. if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s; b = (j = yc.length) - (i = xc.length); // Append zeros to xc if shorter. // No need to add zeros to yc if shorter as subtract only needs to start at yc.length. if (b > 0) for (; b--; xc[i++] = 0); b = BASE - 1; // Subtract yc from xc. for (; j > a;) { if (xc[--j] < yc[j]) { for (i = j; i && !xc[--i]; xc[i] = b); --xc[i]; xc[j] += BASE; } xc[j] -= yc[j]; } // Remove leading zeros and adjust exponent accordingly. for (; xc[0] == 0; xc.splice(0, 1), --ye); // Zero? if (!xc[0]) { // Following IEEE 754 (2008) 6.3, // n - n = +0 but n - n = -0 when rounding towards -Infinity. y.s = ROUNDING_MODE == 3 ? -1 : 1; y.c = [y.e = 0]; return y; } // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity // for finite x and y. return normalise(y, xc, ye); }; /* * n % 0 = N * n % N = N * n % I = n * 0 % n = 0 * -0 % n = -0 * 0 % 0 = N * 0 % N = N * 0 % I = 0 * N % n = N * N % 0 = N * N % N = N * N % I = N * I % n = N * I % 0 = N * I % N = N * I % I = N * * Return a new BigNumber whose value is the value of this BigNumber modulo the value of * BigNumber(y, b). The result depends on the value of MODULO_MODE. */ P.modulo = P.mod = function (y, b) { var q, s, x = this; y = new BigNumber(y, b); // Return NaN if x is Infinity or NaN, or y is NaN or zero. if (!x.c || !y.s || y.c && !y.c[0]) { return new BigNumber(NaN); // Return x if y is Infinity or x is zero. } else if (!y.c || x.c && !x.c[0]) { return new BigNumber(x); } if (MODULO_MODE == 9) { // Euclidian division: q = sign(y) * floor(x / abs(y)) // r = x - qy where 0 <= r < abs(y) s = y.s; y.s = 1; q = div(x, y, 0, 3); y.s = s; q.s *= s; } else { q = div(x, y, 0, MODULO_MODE); } y = x.minus(q.times(y)); // To match JavaScript %, ensure sign of zero is sign of dividend. if (!y.c[0] && MODULO_MODE == 1) y.s = x.s; return y; }; /* * n * 0 = 0 * n * N = N * n * I = I * 0 * n = 0 * 0 * 0 = 0 * 0 * N = N * 0 * I = N * N * n = N * N * 0 = N * N * N = N * N * I = N * I * n = I * I * 0 = N * I * N = N * I * I = I * * Return a new BigNumber whose value is the value of this BigNumber multiplied by the value * of BigNumber(y, b). */ P.multipliedBy = P.times = function (y, b) { var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc, base, sqrtBase, x = this, xc = x.c, yc = (y = new BigNumber(y, b)).c; // Either NaN, ±Infinity or ±0? if (!xc || !yc || !xc[0] || !yc[0]) { // Return NaN if either is NaN, or one is 0 and the other is Infinity. if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) { y.c = y.e = y.s = null; } else { y.s *= x.s; // Return ±Infinity if either is ±Infinity. if (!xc || !yc) { y.c = y.e = null; // Return ±0 if either is ±0. } else { y.c = [0]; y.e = 0; } } return y; } e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE); y.s *= x.s; xcL = xc.length; ycL = yc.length; // Ensure xc points to longer array and xcL to its length. if (xcL < ycL) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i; // Initialise the result array with zeros. for (i = xcL + ycL, zc = []; i--; zc.push(0)); base = BASE; sqrtBase = SQRT_BASE; for (i = ycL; --i >= 0;) { c = 0; ylo = yc[i] % sqrtBase; yhi = yc[i] / sqrtBase | 0; for (k = xcL, j = i + k; j > i;) { xlo = xc[--k] % sqrtBase; xhi = xc[k] / sqrtBase | 0; m = yhi * xlo + xhi * ylo; xlo = ylo * xlo + ((m % sqrtBase) * sqrtBase) + zc[j] + c; c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi; zc[j--] = xlo % base; } zc[j] = c; } if (c) { ++e; } else { zc.splice(0, 1); } return normalise(y, zc, e); }; /* * Return a new BigNumber whose value is the value of this BigNumber negated, * i.e. multiplied by -1. */ P.negated = function () { var x = new BigNumber(this); x.s = -x.s || null; return x; }; /* * n + 0 = n * n + N = N * n + I = I * 0 + n = n * 0 + 0 = 0 * 0 + N = N * 0 + I = I * N + n = N * N + 0 = N * N + N = N * N + I = N * I + n = I * I + 0 = I * I + N = N * I + I = I * * Return a new BigNumber whose value is the value of this BigNumber plus the value of * BigNumber(y, b). */ P.plus = function (y, b) { var t, x = this, a = x.s; y = new BigNumber(y, b); b = y.s; // Either NaN? if (!a || !b) return new BigNumber(NaN); // Signs differ? if (a != b) { y.s = -b; return x.minus(y); } var xe = x.e / LOG_BASE, ye = y.e / LOG_BASE, xc = x.c, yc = y.c; if (!xe || !ye) { // Return ±Infinity if either ±Infinity. if (!xc || !yc) return new BigNumber(a / 0); // Either zero? // Return y if y is non-zero, x if x is non-zero, or zero if both are zero. if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber(xc[0] ? x : a * 0); } xe = bitFloor(xe); ye = bitFloor(ye); xc = xc.slice(); // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts. if (a = xe - ye) { if (a > 0) { ye = xe; t = yc; } else { a = -a; t = xc; } t.reverse(); for (; a--; t.push(0)); t.reverse(); } a = xc.length; b = yc.length; // Point xc to the longer array, and b to the shorter length. if (a - b < 0) t = yc, yc = xc, xc = t, b = a; // Only start adding at yc.length - 1 as the further digits of xc can be ignored. for (a = 0; b;) { a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0; xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE; } if (a) { xc = [a].concat(xc); ++ye; } // No need to check for zero, as +x + +y != 0 && -x + -y != 0 // ye = MAX_EXP + 1 possible return normalise(y, xc, ye); }; /* * If sd is undefined or null or true or false, return the number of significant digits of * the value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN. * If sd is true include integer-part trailing zeros in the count. * * Otherwise, if sd is a number, return a new BigNumber whose value is the value of this * BigNumber rounded to a maximum of sd significant digits using rounding mode rm, or * ROUNDING_MODE if rm is omitted. * * sd {number|boolean} number: significant digits: integer, 1 to MAX inclusive. * boolean: whether to count integer-part trailing zeros: true or false. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. * * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}' */ P.precision = P.sd = function (sd, rm) { var c, n, v, x = this; if (sd != null && sd !== !!sd) { intCheck(sd, 1, MAX); if (rm == null) rm = ROUNDING_MODE; else intCheck(rm, 0, 8); return round(new BigNumber(x), sd, rm); } if (!(c = x.c)) return null; v = c.length - 1; n = v * LOG_BASE + 1; if (v = c[v]) { // Subtract the number of trailing zeros of the last element. for (; v % 10 == 0; v /= 10, n--); // Add the number of digits of the first element. for (v = c[0]; v >= 10; v /= 10, n++); } if (sd && x.e + 1 > n) n = x.e + 1; return n; }; /* * Return a new BigNumber whose value is the value of this BigNumber shifted by k places * (powers of 10). Shift to the right if n > 0, and to the left if n < 0. * * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive. * * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {k}' */ P.shiftedBy = function (k) { intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER); return this.times('1e' + k); }; /* * sqrt(-n) = N * sqrt(N) = N * sqrt(-I) = N * sqrt(I) = I * sqrt(0) = 0 * sqrt(-0) = -0 * * Return a new BigNumber whose value is the square root of the value of this BigNumber, * rounded according to DECIMAL_PLACES and ROUNDING_MODE. */ P.squareRoot = P.sqrt = function () { var m, n, r, rep, t, x = this, c = x.c, s = x.s, e = x.e, dp = DECIMAL_PLACES + 4, half = new BigNumber('0.5'); // Negative/NaN/Infinity/zero? if (s !== 1 || !c || !c[0]) { return new BigNumber(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0); } // Initial estimate. s = Math.sqrt(+valueOf(x)); // Math.sqrt underflow/overflow? // Pass x to Math.sqrt as integer, then adjust the exponent of the result. if (s == 0 || s == 1 / 0) { n = coeffToString(c); if ((n.length + e) % 2 == 0) n += '0'; s = Math.sqrt(+n); e = bitFloor((e + 1) / 2) - (e < 0 || e % 2); if (s == 1 / 0) { n = '5e' + e; } else { n = s.toExponential(); n = n.slice(0, n.indexOf('e') + 1) + e; } r = new BigNumber(n); } else { r = new BigNumber(s + ''); } // Check for zero. // r could be zero if MIN_EXP is changed after the this value was created. // This would cause a division by zero (x/t) and hence Infinity below, which would cause // coeffToString to throw. if (r.c[0]) { e = r.e; s = e + dp; if (s < 3) s = 0; // Newton-Raphson iteration. for (; ;) { t = r; r = half.times(t.plus(div(x, t, dp, 1))); if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) { // The exponent of r may here be one less than the final result exponent, // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits // are indexed correctly. if (r.e < e) --s; n = n.slice(s - 3, s + 1); // The 4th rounding digit may be in error by -1 so if the 4 rounding digits // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the // iteration. if (n == '9999' || !rep && n == '4999') { // On the first iteration only, check to see if rounding up gives the // exact result as the nines may infinitely repeat. if (!rep) { round(t, t.e + DECIMAL_PLACES + 2, 0); if (t.times(t).eq(x)) { r = t; break; } } dp += 4; s += 4; rep = 1; } else { // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact // result. If not, then there are further digits and m will be truthy. if (!+n || !+n.slice(1) && n.charAt(0) == '5') { // Truncate to the first rounding digit. round(r, r.e + DECIMAL_PLACES + 2, 1); m = !r.times(r).eq(x); } break; } } } } return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m); }; /* * Return a string representing the value of this BigNumber in exponential notation and * rounded using ROUNDING_MODE to dp fixed decimal places. * * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. * * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}' */ P.toExponential = function (dp, rm) { if (dp != null) { intCheck(dp, 0, MAX); dp++; } return format(this, dp, rm, 1); }; /* * Return a string representing the value of this BigNumber in fixed-point notation rounding * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted. * * Note: as with JavaScript's number type, (-0).toFixed(0) is '0', * but e.g. (-0.00001).toFixed(0) is '-0'. * * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. * * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}' */ P.toFixed = function (dp, rm) { if (dp != null) { intCheck(dp, 0, MAX); dp = dp + this.e + 1; } return format(this, dp, rm); }; /* * Return a string representing the value of this BigNumber in fixed-point notation rounded * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties * of the format or FORMAT object (see BigNumber.set). * * The formatting object may contain some or all of the properties shown below. * * FORMAT = { * prefix: '', * groupSize: 3, * secondaryGroupSize: 0, * groupSeparator: ',', * decimalSeparator: '.', * fractionGroupSize: 0, * fractionGroupSeparator: '\xA0', // non-breaking space * suffix: '' * }; * * [dp] {number} Decimal places. Integer, 0 to MAX inclusive. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. * [format] {object} Formatting options. See FORMAT pbject above. * * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}' * '[BigNumber Error] Argument not an object: {format}' */ P.toFormat = function (dp, rm, format) { var str, x = this; if (format == null) { if (dp != null && rm && typeof rm == 'object') { format = rm; rm = null; } else if (dp && typeof dp == 'object') { format = dp; dp = rm = null; } else { format = FORMAT; } } else if (typeof format != 'object') { throw Error (bignumberError + 'Argument not an object: ' + format); } str = x.toFixed(dp, rm); if (x.c) { var i, arr = str.split('.'), g1 = +format.groupSize, g2 = +format.secondaryGroupSize, groupSeparator = format.groupSeparator || '', intPart = arr[0], fractionPart = arr[1], isNeg = x.s < 0, intDigits = isNeg ? intPart.slice(1) : intPart, len = intDigits.length; if (g2) i = g1, g1 = g2, g2 = i, len -= i; if (g1 > 0 && len > 0) { i = len % g1 || g1; intPart = intDigits.substr(0, i); for (; i < len; i += g1) intPart += groupSeparator + intDigits.substr(i, g1); if (g2 > 0) intPart += groupSeparator + intDigits.slice(i); if (isNeg) intPart = '-' + intPart; } str = fractionPart ? intPart + (format.decimalSeparator || '') + ((g2 = +format.fractionGroupSize) ? fractionPart.replace(new RegExp('\\d{' + g2 + '}\\B', 'g'), '$&' + (format.fractionGroupSeparator || '')) : fractionPart) : intPart; } return (format.prefix || '') + str + (format.suffix || ''); }; /* * Return an array of two BigNumbers representing the value of this BigNumber as a simple * fraction with an integer numerator and an integer denominator. * The denominator will be a positive non-zero value less than or equal to the specified * maximum denominator. If a maximum denominator is not specified, the denominator will be * the lowest value necessary to represent the number exactly. * * [md] {number|string|BigNumber} Integer >= 1, or Infinity. The maximum denominator. * * '[BigNumber Error] Argument {not an integer|out of range} : {md}' */ P.toFraction = function (md) { var d, d0, d1, d2, e, exp, n, n0, n1, q, r, s, x = this, xc = x.c; if (md != null) { n = new BigNumber(md); // Throw if md is less than one or is not an integer, unless it is Infinity. if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) { throw Error (bignumberError + 'Argument ' + (n.isInteger() ? 'out of range: ' : 'not an integer: ') + valueOf(n)); } } if (!xc) return new BigNumber(x); d = new BigNumber(ONE); n1 = d0 = new BigNumber(ONE); d1 = n0 = new BigNumber(ONE); s = coeffToString(xc); // Determine initial denominator. // d is a power of 10 and the minimum max denominator that specifies the value exactly. e = d.e = s.length - x.e - 1; d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp]; md = !md || n.comparedTo(d) > 0 ? (e > 0 ? d : n1) : n; exp = MAX_EXP; MAX_EXP = 1 / 0; n = new BigNumber(s); // n0 = d1 = 0 n0.c[0] = 0; for (; ;) { q = div(n, d, 0, 1); d2 = d0.plus(q.times(d1)); if (d2.comparedTo(md) == 1) break; d0 = d1; d1 = d2; n1 = n0.plus(q.times(d2 = n1)); n0 = d2; d = n.minus(q.times(d2 = d)); n = d2; } d2 = div(md.minus(d0), d1, 0, 1); n0 = n0.plus(d2.times(n1)); d0 = d0.plus(d2.times(d1)); n0.s = n1.s = x.s; e = e * 2; // Determine which fraction is closer to x, n0/d0 or n1/d1 r = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo( div(n0, d0, e, ROUNDING_MODE).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0]; MAX_EXP = exp; return r; }; /* * Return the value of this BigNumber converted to a number primitive. */ P.toNumber = function () { return +valueOf(this); }; /* * Return a string representing the value of this BigNumber rounded to sd significant digits * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits * necessary to represent the integer part of the value in fixed-point notation, then use * exponential notation. * * [sd] {number} Significant digits. Integer, 1 to MAX inclusive. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. * * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}' */ P.toPrecision = function (sd, rm) { if (sd != null) intCheck(sd, 1, MAX); return format(this, sd, rm, 2); }; /* * Return a string representing the value of this BigNumber in base b, or base 10 if b is * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than * TO_EXP_NEG, return exponential notation. * * [b] {number} Integer, 2 to ALPHABET.length inclusive. * * '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}' */ P.toString = function (b) { var str, n = this, s = n.s, e = n.e; // Infinity or NaN? if (e === null) { if (s) { str = 'Infinity'; if (s < 0) str = '-' + str; } else { str = 'NaN'; } } else { if (b == null) { str = e <= TO_EXP_NEG || e >= TO_EXP_POS ? toExponential(coeffToString(n.c), e) : toFixedPoint(coeffToString(n.c), e, '0'); } else if (b === 10 && alphabetHasNormalDecimalDigits) { n = round(new BigNumber(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE); str = toFixedPoint(coeffToString(n.c), n.e, '0'); } else { intCheck(b, 2, ALPHABET.length, 'Base'); str = convertBase(toFixedPoint(coeffToString(n.c), e, '0'), 10, b, s, true); } if (s < 0 && n.c[0]) str = '-' + str; } return str; }; /* * Return as toString, but do not accept a base argument, and include the minus sign for * negative zero. */ P.valueOf = P.toJSON = function () { return valueOf(this); }; P._isBigNumber = true; if (configObject != null) BigNumber.set(configObject); return BigNumber; } // PRIVATE HELPER FUNCTIONS // These functions don't need access to variables, // e.g. DECIMAL_PLACES, in the scope of the `clone` function above. function bitFloor(n) { var i = n | 0; return n > 0 || n === i ? i : i - 1; } // Return a coefficient array as a string of base 10 digits. function coeffToString(a) { var s, z, i = 1, j = a.length, r = a[0] + ''; for (; i < j;) { s = a[i++] + ''; z = LOG_BASE - s.length; for (; z--; s = '0' + s); r += s; } // Determine trailing zeros. for (j = r.length; r.charCodeAt(--j) === 48;); return r.slice(0, j + 1 || 1); } // Compare the value of BigNumbers x and y. function compare(x, y) { var a, b, xc = x.c, yc = y.c, i = x.s, j = y.s, k = x.e, l = y.e; // Either NaN? if (!i || !j) return null; a = xc && !xc[0]; b = yc && !yc[0]; // Either zero? if (a || b) return a ? b ? 0 : -j : i; // Signs differ? if (i != j) return i; a = i < 0; b = k == l; // Either Infinity? if (!xc || !yc) return b ? 0 : !xc ^ a ? 1 : -1; // Compare exponents. if (!b) return k > l ^ a ? 1 : -1; j = (k = xc.length) < (l = yc.length) ? k : l; // Compare digit by digit. for (i = 0; i < j; i++) if (xc[i] != yc[i]) return xc[i] > yc[i] ^ a ? 1 : -1; // Compare lengths. return k == l ? 0 : k > l ^ a ? 1 : -1; } /* * Check that n is a primitive number, an integer, and in range, otherwise throw. */ function intCheck(n, min, max, name) { if (n < min || n > max || n !== mathfloor(n)) { throw Error (bignumberError + (name || 'Argument') + (typeof n == 'number' ? n < min || n > max ? ' out of range: ' : ' not an integer: ' : ' not a primitive number: ') + String(n)); } } // Assumes finite n. function isOdd(n) { var k = n.c.length - 1; return bitFloor(n.e / LOG_BASE) == k && n.c[k] % 2 != 0; } function toExponential(str, e) { return (str.length > 1 ? str.charAt(0) + '.' + str.slice(1) : str) + (e < 0 ? 'e' : 'e+') + e; } function toFixedPoint(str, e, z) { var len, zs; // Negative exponent? if (e < 0) { // Prepend zeros. for (zs = z + '.'; ++e; zs += z); str = zs + str; // Positive exponent } else { len = str.length; // Append zeros. if (++e > len) { for (zs = z, e -= len; --e; zs += z); str += zs; } else if (e < len) { str = str.slice(0, e) + '.' + str.slice(e); } } return str; } // EXPORT BigNumber = clone(); BigNumber['default'] = BigNumber.BigNumber = BigNumber; // AMD. if (true) { !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () { return BigNumber; }).call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); // Node.js and other environments that support module.exports. } else {} })(this); /***/ }), /***/ 48764: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ /* eslint-disable no-proto */ const base64 = __webpack_require__(79742) const ieee754 = __webpack_require__(80645) const customInspectSymbol = (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation : null exports.Buffer = Buffer exports.SlowBuffer = SlowBuffer exports.INSPECT_MAX_BYTES = 50 const K_MAX_LENGTH = 0x7fffffff exports.kMaxLength = K_MAX_LENGTH /** * If `Buffer.TYPED_ARRAY_SUPPORT`: * === true Use Uint8Array implementation (fastest) * === false Print warning and recommend using `buffer` v4.x which has an Object * implementation (most compatible, even IE6) * * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, * Opera 11.6+, iOS 4.2+. * * We report that the browser does not support typed arrays if the are not subclassable * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array` * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support * for __proto__ and has a buggy typed array implementation. */ Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport() if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' && typeof console.error === 'function') { console.error( 'This browser lacks typed array (Uint8Array) support which is required by ' + '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.' ) } function typedArraySupport () { // Can typed array instances can be augmented? try { const arr = new Uint8Array(1) const proto = { foo: function () { return 42 } } Object.setPrototypeOf(proto, Uint8Array.prototype) Object.setPrototypeOf(arr, proto) return arr.foo() === 42 } catch (e) { return false } } Object.defineProperty(Buffer.prototype, 'parent', { enumerable: true, get: function () { if (!Buffer.isBuffer(this)) return undefined return this.buffer } }) Object.defineProperty(Buffer.prototype, 'offset', { enumerable: true, get: function () { if (!Buffer.isBuffer(this)) return undefined return this.byteOffset } }) function createBuffer (length) { if (length > K_MAX_LENGTH) { throw new RangeError('The value "' + length + '" is invalid for option "size"') } // Return an augmented `Uint8Array` instance const buf = new Uint8Array(length) Object.setPrototypeOf(buf, Buffer.prototype) return buf } /** * The Buffer constructor returns instances of `Uint8Array` that have their * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of * `Uint8Array`, so the returned instances will have all the node `Buffer` methods * and the `Uint8Array` methods. Square bracket notation works as expected -- it * returns a single octet. * * The `Uint8Array` prototype remains unmodified. */ function Buffer (arg, encodingOrOffset, length) { // Common case. if (typeof arg === 'number') { if (typeof encodingOrOffset === 'string') { throw new TypeError( 'The "string" argument must be of type string. Received type number' ) } return allocUnsafe(arg) } return from(arg, encodingOrOffset, length) } Buffer.poolSize = 8192 // not used by this implementation function from (value, encodingOrOffset, length) { if (typeof value === 'string') { return fromString(value, encodingOrOffset) } if (ArrayBuffer.isView(value)) { return fromArrayView(value) } if (value == null) { throw new TypeError( 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + 'or Array-like Object. Received type ' + (typeof value) ) } if (isInstance(value, ArrayBuffer) || (value && isInstance(value.buffer, ArrayBuffer))) { return fromArrayBuffer(value, encodingOrOffset, length) } if (typeof SharedArrayBuffer !== 'undefined' && (isInstance(value, SharedArrayBuffer) || (value && isInstance(value.buffer, SharedArrayBuffer)))) { return fromArrayBuffer(value, encodingOrOffset, length) } if (typeof value === 'number') { throw new TypeError( 'The "value" argument must not be of type number. Received type number' ) } const valueOf = value.valueOf && value.valueOf() if (valueOf != null && valueOf !== value) { return Buffer.from(valueOf, encodingOrOffset, length) } const b = fromObject(value) if (b) return b if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === 'function') { return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length) } throw new TypeError( 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + 'or Array-like Object. Received type ' + (typeof value) ) } /** * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError * if value is a number. * Buffer.from(str[, encoding]) * Buffer.from(array) * Buffer.from(buffer) * Buffer.from(arrayBuffer[, byteOffset[, length]]) **/ Buffer.from = function (value, encodingOrOffset, length) { return from(value, encodingOrOffset, length) } // Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug: // https://github.com/feross/buffer/pull/148 Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype) Object.setPrototypeOf(Buffer, Uint8Array) function assertSize (size) { if (typeof size !== 'number') { throw new TypeError('"size" argument must be of type number') } else if (size < 0) { throw new RangeError('The value "' + size + '" is invalid for option "size"') } } function alloc (size, fill, encoding) { assertSize(size) if (size <= 0) { return createBuffer(size) } if (fill !== undefined) { // Only pay attention to encoding if it's a string. This // prevents accidentally sending in a number that would // be interpreted as a start offset. return typeof encoding === 'string' ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill) } return createBuffer(size) } /** * Creates a new filled Buffer instance. * alloc(size[, fill[, encoding]]) **/ Buffer.alloc = function (size, fill, encoding) { return alloc(size, fill, encoding) } function allocUnsafe (size) { assertSize(size) return createBuffer(size < 0 ? 0 : checked(size) | 0) } /** * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. * */ Buffer.allocUnsafe = function (size) { return allocUnsafe(size) } /** * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. */ Buffer.allocUnsafeSlow = function (size) { return allocUnsafe(size) } function fromString (string, encoding) { if (typeof encoding !== 'string' || encoding === '') { encoding = 'utf8' } if (!Buffer.isEncoding(encoding)) { throw new TypeError('Unknown encoding: ' + encoding) } const length = byteLength(string, encoding) | 0 let buf = createBuffer(length) const actual = buf.write(string, encoding) if (actual !== length) { // Writing a hex string, for example, that contains invalid characters will // cause everything after the first invalid character to be ignored. (e.g. // 'abxxcd' will be treated as 'ab') buf = buf.slice(0, actual) } return buf } function fromArrayLike (array) { const length = array.length < 0 ? 0 : checked(array.length) | 0 const buf = createBuffer(length) for (let i = 0; i < length; i += 1) { buf[i] = array[i] & 255 } return buf } function fromArrayView (arrayView) { if (isInstance(arrayView, Uint8Array)) { const copy = new Uint8Array(arrayView) return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength) } return fromArrayLike(arrayView) } function fromArrayBuffer (array, byteOffset, length) { if (byteOffset < 0 || array.byteLength < byteOffset) { throw new RangeError('"offset" is outside of buffer bounds') } if (array.byteLength < byteOffset + (length || 0)) { throw new RangeError('"length" is outside of buffer bounds') } let buf if (byteOffset === undefined && length === undefined) { buf = new Uint8Array(array) } else if (length === undefined) { buf = new Uint8Array(array, byteOffset) } else { buf = new Uint8Array(array, byteOffset, length) } // Return an augmented `Uint8Array` instance Object.setPrototypeOf(buf, Buffer.prototype) return buf } function fromObject (obj) { if (Buffer.isBuffer(obj)) { const len = checked(obj.length) | 0 const buf = createBuffer(len) if (buf.length === 0) { return buf } obj.copy(buf, 0, 0, len) return buf } if (obj.length !== undefined) { if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) { return createBuffer(0) } return fromArrayLike(obj) } if (obj.type === 'Buffer' && Array.isArray(obj.data)) { return fromArrayLike(obj.data) } } function checked (length) { // Note: cannot use `length < K_MAX_LENGTH` here because that fails when // length is NaN (which is otherwise coerced to zero.) if (length >= K_MAX_LENGTH) { throw new RangeError('Attempt to allocate Buffer larger than maximum ' + 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes') } return length | 0 } function SlowBuffer (length) { if (+length != length) { // eslint-disable-line eqeqeq length = 0 } return Buffer.alloc(+length) } Buffer.isBuffer = function isBuffer (b) { return b != null && b._isBuffer === true && b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false } Buffer.compare = function compare (a, b) { if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength) if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength) if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { throw new TypeError( 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array' ) } if (a === b) return 0 let x = a.length let y = b.length for (let i = 0, len = Math.min(x, y); i < len; ++i) { if (a[i] !== b[i]) { x = a[i] y = b[i] break } } if (x < y) return -1 if (y < x) return 1 return 0 } Buffer.isEncoding = function isEncoding (encoding) { switch (String(encoding).toLowerCase()) { case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'latin1': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return true default: return false } } Buffer.concat = function concat (list, length) { if (!Array.isArray(list)) { throw new TypeError('"list" argument must be an Array of Buffers') } if (list.length === 0) { return Buffer.alloc(0) } let i if (length === undefined) { length = 0 for (i = 0; i < list.length; ++i) { length += list[i].length } } const buffer = Buffer.allocUnsafe(length) let pos = 0 for (i = 0; i < list.length; ++i) { let buf = list[i] if (isInstance(buf, Uint8Array)) { if (pos + buf.length > buffer.length) { if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf) buf.copy(buffer, pos) } else { Uint8Array.prototype.set.call( buffer, buf, pos ) } } else if (!Buffer.isBuffer(buf)) { throw new TypeError('"list" argument must be an Array of Buffers') } else { buf.copy(buffer, pos) } pos += buf.length } return buffer } function byteLength (string, encoding) { if (Buffer.isBuffer(string)) { return string.length } if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { return string.byteLength } if (typeof string !== 'string') { throw new TypeError( 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + 'Received type ' + typeof string ) } const len = string.length const mustMatch = (arguments.length > 2 && arguments[2] === true) if (!mustMatch && len === 0) return 0 // Use a for loop to avoid recursion let loweredCase = false for (;;) { switch (encoding) { case 'ascii': case 'latin1': case 'binary': return len case 'utf8': case 'utf-8': return utf8ToBytes(string).length case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return len * 2 case 'hex': return len >>> 1 case 'base64': return base64ToBytes(string).length default: if (loweredCase) { return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8 } encoding = ('' + encoding).toLowerCase() loweredCase = true } } } Buffer.byteLength = byteLength function slowToString (encoding, start, end) { let loweredCase = false // No need to verify that "this.length <= MAX_UINT32" since it's a read-only // property of a typed array. // This behaves neither like String nor Uint8Array in that we set start/end // to their upper/lower bounds if the value passed is out of range. // undefined is handled specially as per ECMA-262 6th Edition, // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. if (start === undefined || start < 0) { start = 0 } // Return early if start > this.length. Done here to prevent potential uint32 // coercion fail below. if (start > this.length) { return '' } if (end === undefined || end > this.length) { end = this.length } if (end <= 0) { return '' } // Force coercion to uint32. This will also coerce falsey/NaN values to 0. end >>>= 0 start >>>= 0 if (end <= start) { return '' } if (!encoding) encoding = 'utf8' while (true) { switch (encoding) { case 'hex': return hexSlice(this, start, end) case 'utf8': case 'utf-8': return utf8Slice(this, start, end) case 'ascii': return asciiSlice(this, start, end) case 'latin1': case 'binary': return latin1Slice(this, start, end) case 'base64': return base64Slice(this, start, end) case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return utf16leSlice(this, start, end) default: if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) encoding = (encoding + '').toLowerCase() loweredCase = true } } } // This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package) // to detect a Buffer instance. It's not possible to use `instanceof Buffer` // reliably in a browserify context because there could be multiple different // copies of the 'buffer' package in use. This method works even for Buffer // instances that were created from another copy of the `buffer` package. // See: https://github.com/feross/buffer/issues/154 Buffer.prototype._isBuffer = true function swap (b, n, m) { const i = b[n] b[n] = b[m] b[m] = i } Buffer.prototype.swap16 = function swap16 () { const len = this.length if (len % 2 !== 0) { throw new RangeError('Buffer size must be a multiple of 16-bits') } for (let i = 0; i < len; i += 2) { swap(this, i, i + 1) } return this } Buffer.prototype.swap32 = function swap32 () { const len = this.length if (len % 4 !== 0) { throw new RangeError('Buffer size must be a multiple of 32-bits') } for (let i = 0; i < len; i += 4) { swap(this, i, i + 3) swap(this, i + 1, i + 2) } return this } Buffer.prototype.swap64 = function swap64 () { const len = this.length if (len % 8 !== 0) { throw new RangeError('Buffer size must be a multiple of 64-bits') } for (let i = 0; i < len; i += 8) { swap(this, i, i + 7) swap(this, i + 1, i + 6) swap(this, i + 2, i + 5) swap(this, i + 3, i + 4) } return this } Buffer.prototype.toString = function toString () { const length = this.length if (length === 0) return '' if (arguments.length === 0) return utf8Slice(this, 0, length) return slowToString.apply(this, arguments) } Buffer.prototype.toLocaleString = Buffer.prototype.toString Buffer.prototype.equals = function equals (b) { if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') if (this === b) return true return Buffer.compare(this, b) === 0 } Buffer.prototype.inspect = function inspect () { let str = '' const max = exports.INSPECT_MAX_BYTES str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim() if (this.length > max) str += ' ... ' return '' } if (customInspectSymbol) { Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect } Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { if (isInstance(target, Uint8Array)) { target = Buffer.from(target, target.offset, target.byteLength) } if (!Buffer.isBuffer(target)) { throw new TypeError( 'The "target" argument must be one of type Buffer or Uint8Array. ' + 'Received type ' + (typeof target) ) } if (start === undefined) { start = 0 } if (end === undefined) { end = target ? target.length : 0 } if (thisStart === undefined) { thisStart = 0 } if (thisEnd === undefined) { thisEnd = this.length } if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { throw new RangeError('out of range index') } if (thisStart >= thisEnd && start >= end) { return 0 } if (thisStart >= thisEnd) { return -1 } if (start >= end) { return 1 } start >>>= 0 end >>>= 0 thisStart >>>= 0 thisEnd >>>= 0 if (this === target) return 0 let x = thisEnd - thisStart let y = end - start const len = Math.min(x, y) const thisCopy = this.slice(thisStart, thisEnd) const targetCopy = target.slice(start, end) for (let i = 0; i < len; ++i) { if (thisCopy[i] !== targetCopy[i]) { x = thisCopy[i] y = targetCopy[i] break } } if (x < y) return -1 if (y < x) return 1 return 0 } // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, // OR the last index of `val` in `buffer` at offset <= `byteOffset`. // // Arguments: // - buffer - a Buffer to search // - val - a string, Buffer, or number // - byteOffset - an index into `buffer`; will be clamped to an int32 // - encoding - an optional encoding, relevant is val is a string // - dir - true for indexOf, false for lastIndexOf function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { // Empty buffer means no match if (buffer.length === 0) return -1 // Normalize byteOffset if (typeof byteOffset === 'string') { encoding = byteOffset byteOffset = 0 } else if (byteOffset > 0x7fffffff) { byteOffset = 0x7fffffff } else if (byteOffset < -0x80000000) { byteOffset = -0x80000000 } byteOffset = +byteOffset // Coerce to Number. if (numberIsNaN(byteOffset)) { // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer byteOffset = dir ? 0 : (buffer.length - 1) } // Normalize byteOffset: negative offsets start from the end of the buffer if (byteOffset < 0) byteOffset = buffer.length + byteOffset if (byteOffset >= buffer.length) { if (dir) return -1 else byteOffset = buffer.length - 1 } else if (byteOffset < 0) { if (dir) byteOffset = 0 else return -1 } // Normalize val if (typeof val === 'string') { val = Buffer.from(val, encoding) } // Finally, search either indexOf (if dir is true) or lastIndexOf if (Buffer.isBuffer(val)) { // Special case: looking for empty string/buffer always fails if (val.length === 0) { return -1 } return arrayIndexOf(buffer, val, byteOffset, encoding, dir) } else if (typeof val === 'number') { val = val & 0xFF // Search for a byte value [0-255] if (typeof Uint8Array.prototype.indexOf === 'function') { if (dir) { return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) } else { return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) } } return arrayIndexOf(buffer, [val], byteOffset, encoding, dir) } throw new TypeError('val must be string, number or Buffer') } function arrayIndexOf (arr, val, byteOffset, encoding, dir) { let indexSize = 1 let arrLength = arr.length let valLength = val.length if (encoding !== undefined) { encoding = String(encoding).toLowerCase() if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') { if (arr.length < 2 || val.length < 2) { return -1 } indexSize = 2 arrLength /= 2 valLength /= 2 byteOffset /= 2 } } function read (buf, i) { if (indexSize === 1) { return buf[i] } else { return buf.readUInt16BE(i * indexSize) } } let i if (dir) { let foundIndex = -1 for (i = byteOffset; i < arrLength; i++) { if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { if (foundIndex === -1) foundIndex = i if (i - foundIndex + 1 === valLength) return foundIndex * indexSize } else { if (foundIndex !== -1) i -= i - foundIndex foundIndex = -1 } } } else { if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength for (i = byteOffset; i >= 0; i--) { let found = true for (let j = 0; j < valLength; j++) { if (read(arr, i + j) !== read(val, j)) { found = false break } } if (found) return i } } return -1 } Buffer.prototype.includes = function includes (val, byteOffset, encoding) { return this.indexOf(val, byteOffset, encoding) !== -1 } Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { return bidirectionalIndexOf(this, val, byteOffset, encoding, true) } Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { return bidirectionalIndexOf(this, val, byteOffset, encoding, false) } function hexWrite (buf, string, offset, length) { offset = Number(offset) || 0 const remaining = buf.length - offset if (!length) { length = remaining } else { length = Number(length) if (length > remaining) { length = remaining } } const strLen = string.length if (length > strLen / 2) { length = strLen / 2 } let i for (i = 0; i < length; ++i) { const parsed = parseInt(string.substr(i * 2, 2), 16) if (numberIsNaN(parsed)) return i buf[offset + i] = parsed } return i } function utf8Write (buf, string, offset, length) { return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) } function asciiWrite (buf, string, offset, length) { return blitBuffer(asciiToBytes(string), buf, offset, length) } function base64Write (buf, string, offset, length) { return blitBuffer(base64ToBytes(string), buf, offset, length) } function ucs2Write (buf, string, offset, length) { return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) } Buffer.prototype.write = function write (string, offset, length, encoding) { // Buffer#write(string) if (offset === undefined) { encoding = 'utf8' length = this.length offset = 0 // Buffer#write(string, encoding) } else if (length === undefined && typeof offset === 'string') { encoding = offset length = this.length offset = 0 // Buffer#write(string, offset[, length][, encoding]) } else if (isFinite(offset)) { offset = offset >>> 0 if (isFinite(length)) { length = length >>> 0 if (encoding === undefined) encoding = 'utf8' } else { encoding = length length = undefined } } else { throw new Error( 'Buffer.write(string, encoding, offset[, length]) is no longer supported' ) } const remaining = this.length - offset if (length === undefined || length > remaining) length = remaining if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { throw new RangeError('Attempt to write outside buffer bounds') } if (!encoding) encoding = 'utf8' let loweredCase = false for (;;) { switch (encoding) { case 'hex': return hexWrite(this, string, offset, length) case 'utf8': case 'utf-8': return utf8Write(this, string, offset, length) case 'ascii': case 'latin1': case 'binary': return asciiWrite(this, string, offset, length) case 'base64': // Warning: maxLength not taken into account in base64Write return base64Write(this, string, offset, length) case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return ucs2Write(this, string, offset, length) default: if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) encoding = ('' + encoding).toLowerCase() loweredCase = true } } } Buffer.prototype.toJSON = function toJSON () { return { type: 'Buffer', data: Array.prototype.slice.call(this._arr || this, 0) } } function base64Slice (buf, start, end) { if (start === 0 && end === buf.length) { return base64.fromByteArray(buf) } else { return base64.fromByteArray(buf.slice(start, end)) } } function utf8Slice (buf, start, end) { end = Math.min(buf.length, end) const res = [] let i = start while (i < end) { const firstByte = buf[i] let codePoint = null let bytesPerSequence = (firstByte > 0xEF) ? 4 : (firstByte > 0xDF) ? 3 : (firstByte > 0xBF) ? 2 : 1 if (i + bytesPerSequence <= end) { let secondByte, thirdByte, fourthByte, tempCodePoint switch (bytesPerSequence) { case 1: if (firstByte < 0x80) { codePoint = firstByte } break case 2: secondByte = buf[i + 1] if ((secondByte & 0xC0) === 0x80) { tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) if (tempCodePoint > 0x7F) { codePoint = tempCodePoint } } break case 3: secondByte = buf[i + 1] thirdByte = buf[i + 2] if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { codePoint = tempCodePoint } } break case 4: secondByte = buf[i + 1] thirdByte = buf[i + 2] fourthByte = buf[i + 3] if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { codePoint = tempCodePoint } } } } if (codePoint === null) { // we did not generate a valid codePoint so insert a // replacement char (U+FFFD) and advance only 1 byte codePoint = 0xFFFD bytesPerSequence = 1 } else if (codePoint > 0xFFFF) { // encode to utf16 (surrogate pair dance) codePoint -= 0x10000 res.push(codePoint >>> 10 & 0x3FF | 0xD800) codePoint = 0xDC00 | codePoint & 0x3FF } res.push(codePoint) i += bytesPerSequence } return decodeCodePointsArray(res) } // Based on http://stackoverflow.com/a/22747272/680742, the browser with // the lowest limit is Chrome, with 0x10000 args. // We go 1 magnitude less, for safety const MAX_ARGUMENTS_LENGTH = 0x1000 function decodeCodePointsArray (codePoints) { const len = codePoints.length if (len <= MAX_ARGUMENTS_LENGTH) { return String.fromCharCode.apply(String, codePoints) // avoid extra slice() } // Decode in chunks to avoid "call stack size exceeded". let res = '' let i = 0 while (i < len) { res += String.fromCharCode.apply( String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) ) } return res } function asciiSlice (buf, start, end) { let ret = '' end = Math.min(buf.length, end) for (let i = start; i < end; ++i) { ret += String.fromCharCode(buf[i] & 0x7F) } return ret } function latin1Slice (buf, start, end) { let ret = '' end = Math.min(buf.length, end) for (let i = start; i < end; ++i) { ret += String.fromCharCode(buf[i]) } return ret } function hexSlice (buf, start, end) { const len = buf.length if (!start || start < 0) start = 0 if (!end || end < 0 || end > len) end = len let out = '' for (let i = start; i < end; ++i) { out += hexSliceLookupTable[buf[i]] } return out } function utf16leSlice (buf, start, end) { const bytes = buf.slice(start, end) let res = '' // If bytes.length is odd, the last 8 bits must be ignored (same as node.js) for (let i = 0; i < bytes.length - 1; i += 2) { res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256)) } return res } Buffer.prototype.slice = function slice (start, end) { const len = this.length start = ~~start end = end === undefined ? len : ~~end if (start < 0) { start += len if (start < 0) start = 0 } else if (start > len) { start = len } if (end < 0) { end += len if (end < 0) end = 0 } else if (end > len) { end = len } if (end < start) end = start const newBuf = this.subarray(start, end) // Return an augmented `Uint8Array` instance Object.setPrototypeOf(newBuf, Buffer.prototype) return newBuf } /* * Need to make sure that buffer isn't trying to write out of bounds. */ function checkOffset (offset, ext, length) { if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') } Buffer.prototype.readUintLE = Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { offset = offset >>> 0 byteLength = byteLength >>> 0 if (!noAssert) checkOffset(offset, byteLength, this.length) let val = this[offset] let mul = 1 let i = 0 while (++i < byteLength && (mul *= 0x100)) { val += this[offset + i] * mul } return val } Buffer.prototype.readUintBE = Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { offset = offset >>> 0 byteLength = byteLength >>> 0 if (!noAssert) { checkOffset(offset, byteLength, this.length) } let val = this[offset + --byteLength] let mul = 1 while (byteLength > 0 && (mul *= 0x100)) { val += this[offset + --byteLength] * mul } return val } Buffer.prototype.readUint8 = Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 1, this.length) return this[offset] } Buffer.prototype.readUint16LE = Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 2, this.length) return this[offset] | (this[offset + 1] << 8) } Buffer.prototype.readUint16BE = Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 2, this.length) return (this[offset] << 8) | this[offset + 1] } Buffer.prototype.readUint32LE = Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 4, this.length) return ((this[offset]) | (this[offset + 1] << 8) | (this[offset + 2] << 16)) + (this[offset + 3] * 0x1000000) } Buffer.prototype.readUint32BE = Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 4, this.length) return (this[offset] * 0x1000000) + ((this[offset + 1] << 16) | (this[offset + 2] << 8) | this[offset + 3]) } Buffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) { offset = offset >>> 0 validateNumber(offset, 'offset') const first = this[offset] const last = this[offset + 7] if (first === undefined || last === undefined) { boundsError(offset, this.length - 8) } const lo = first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24 const hi = this[++offset] + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + last * 2 ** 24 return BigInt(lo) + (BigInt(hi) << BigInt(32)) }) Buffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) { offset = offset >>> 0 validateNumber(offset, 'offset') const first = this[offset] const last = this[offset + 7] if (first === undefined || last === undefined) { boundsError(offset, this.length - 8) } const hi = first * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset] const lo = this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last return (BigInt(hi) << BigInt(32)) + BigInt(lo) }) Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { offset = offset >>> 0 byteLength = byteLength >>> 0 if (!noAssert) checkOffset(offset, byteLength, this.length) let val = this[offset] let mul = 1 let i = 0 while (++i < byteLength && (mul *= 0x100)) { val += this[offset + i] * mul } mul *= 0x80 if (val >= mul) val -= Math.pow(2, 8 * byteLength) return val } Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { offset = offset >>> 0 byteLength = byteLength >>> 0 if (!noAssert) checkOffset(offset, byteLength, this.length) let i = byteLength let mul = 1 let val = this[offset + --i] while (i > 0 && (mul *= 0x100)) { val += this[offset + --i] * mul } mul *= 0x80 if (val >= mul) val -= Math.pow(2, 8 * byteLength) return val } Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 1, this.length) if (!(this[offset] & 0x80)) return (this[offset]) return ((0xff - this[offset] + 1) * -1) } Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 2, this.length) const val = this[offset] | (this[offset + 1] << 8) return (val & 0x8000) ? val | 0xFFFF0000 : val } Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 2, this.length) const val = this[offset + 1] | (this[offset] << 8) return (val & 0x8000) ? val | 0xFFFF0000 : val } Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 4, this.length) return (this[offset]) | (this[offset + 1] << 8) | (this[offset + 2] << 16) | (this[offset + 3] << 24) } Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 4, this.length) return (this[offset] << 24) | (this[offset + 1] << 16) | (this[offset + 2] << 8) | (this[offset + 3]) } Buffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) { offset = offset >>> 0 validateNumber(offset, 'offset') const first = this[offset] const last = this[offset + 7] if (first === undefined || last === undefined) { boundsError(offset, this.length - 8) } const val = this[offset + 4] + this[offset + 5] * 2 ** 8 + this[offset + 6] * 2 ** 16 + (last << 24) // Overflow return (BigInt(val) << BigInt(32)) + BigInt(first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24) }) Buffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) { offset = offset >>> 0 validateNumber(offset, 'offset') const first = this[offset] const last = this[offset + 7] if (first === undefined || last === undefined) { boundsError(offset, this.length - 8) } const val = (first << 24) + // Overflow this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset] return (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last) }) Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 4, this.length) return ieee754.read(this, offset, true, 23, 4) } Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 4, this.length) return ieee754.read(this, offset, false, 23, 4) } Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 8, this.length) return ieee754.read(this, offset, true, 52, 8) } Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 8, this.length) return ieee754.read(this, offset, false, 52, 8) } function checkInt (buf, value, offset, ext, max, min) { if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') if (offset + ext > buf.length) throw new RangeError('Index out of range') } Buffer.prototype.writeUintLE = Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { value = +value offset = offset >>> 0 byteLength = byteLength >>> 0 if (!noAssert) { const maxBytes = Math.pow(2, 8 * byteLength) - 1 checkInt(this, value, offset, byteLength, maxBytes, 0) } let mul = 1 let i = 0 this[offset] = value & 0xFF while (++i < byteLength && (mul *= 0x100)) { this[offset + i] = (value / mul) & 0xFF } return offset + byteLength } Buffer.prototype.writeUintBE = Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { value = +value offset = offset >>> 0 byteLength = byteLength >>> 0 if (!noAssert) { const maxBytes = Math.pow(2, 8 * byteLength) - 1 checkInt(this, value, offset, byteLength, maxBytes, 0) } let i = byteLength - 1 let mul = 1 this[offset + i] = value & 0xFF while (--i >= 0 && (mul *= 0x100)) { this[offset + i] = (value / mul) & 0xFF } return offset + byteLength } Buffer.prototype.writeUint8 = Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) this[offset] = (value & 0xff) return offset + 1 } Buffer.prototype.writeUint16LE = Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) this[offset] = (value & 0xff) this[offset + 1] = (value >>> 8) return offset + 2 } Buffer.prototype.writeUint16BE = Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) this[offset] = (value >>> 8) this[offset + 1] = (value & 0xff) return offset + 2 } Buffer.prototype.writeUint32LE = Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) this[offset + 3] = (value >>> 24) this[offset + 2] = (value >>> 16) this[offset + 1] = (value >>> 8) this[offset] = (value & 0xff) return offset + 4 } Buffer.prototype.writeUint32BE = Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) this[offset] = (value >>> 24) this[offset + 1] = (value >>> 16) this[offset + 2] = (value >>> 8) this[offset + 3] = (value & 0xff) return offset + 4 } function wrtBigUInt64LE (buf, value, offset, min, max) { checkIntBI(value, min, max, buf, offset, 7) let lo = Number(value & BigInt(0xffffffff)) buf[offset++] = lo lo = lo >> 8 buf[offset++] = lo lo = lo >> 8 buf[offset++] = lo lo = lo >> 8 buf[offset++] = lo let hi = Number(value >> BigInt(32) & BigInt(0xffffffff)) buf[offset++] = hi hi = hi >> 8 buf[offset++] = hi hi = hi >> 8 buf[offset++] = hi hi = hi >> 8 buf[offset++] = hi return offset } function wrtBigUInt64BE (buf, value, offset, min, max) { checkIntBI(value, min, max, buf, offset, 7) let lo = Number(value & BigInt(0xffffffff)) buf[offset + 7] = lo lo = lo >> 8 buf[offset + 6] = lo lo = lo >> 8 buf[offset + 5] = lo lo = lo >> 8 buf[offset + 4] = lo let hi = Number(value >> BigInt(32) & BigInt(0xffffffff)) buf[offset + 3] = hi hi = hi >> 8 buf[offset + 2] = hi hi = hi >> 8 buf[offset + 1] = hi hi = hi >> 8 buf[offset] = hi return offset + 8 } Buffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) { return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff')) }) Buffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) { return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff')) }) Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) { const limit = Math.pow(2, (8 * byteLength) - 1) checkInt(this, value, offset, byteLength, limit - 1, -limit) } let i = 0 let mul = 1 let sub = 0 this[offset] = value & 0xFF while (++i < byteLength && (mul *= 0x100)) { if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { sub = 1 } this[offset + i] = ((value / mul) >> 0) - sub & 0xFF } return offset + byteLength } Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) { const limit = Math.pow(2, (8 * byteLength) - 1) checkInt(this, value, offset, byteLength, limit - 1, -limit) } let i = byteLength - 1 let mul = 1 let sub = 0 this[offset + i] = value & 0xFF while (--i >= 0 && (mul *= 0x100)) { if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { sub = 1 } this[offset + i] = ((value / mul) >> 0) - sub & 0xFF } return offset + byteLength } Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) if (value < 0) value = 0xff + value + 1 this[offset] = (value & 0xff) return offset + 1 } Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) this[offset] = (value & 0xff) this[offset + 1] = (value >>> 8) return offset + 2 } Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) this[offset] = (value >>> 8) this[offset + 1] = (value & 0xff) return offset + 2 } Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) this[offset] = (value & 0xff) this[offset + 1] = (value >>> 8) this[offset + 2] = (value >>> 16) this[offset + 3] = (value >>> 24) return offset + 4 } Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) if (value < 0) value = 0xffffffff + value + 1 this[offset] = (value >>> 24) this[offset + 1] = (value >>> 16) this[offset + 2] = (value >>> 8) this[offset + 3] = (value & 0xff) return offset + 4 } Buffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) { return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff')) }) Buffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) { return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff')) }) function checkIEEE754 (buf, value, offset, ext, max, min) { if (offset + ext > buf.length) throw new RangeError('Index out of range') if (offset < 0) throw new RangeError('Index out of range') } function writeFloat (buf, value, offset, littleEndian, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) { checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) } ieee754.write(buf, value, offset, littleEndian, 23, 4) return offset + 4 } Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { return writeFloat(this, value, offset, true, noAssert) } Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { return writeFloat(this, value, offset, false, noAssert) } function writeDouble (buf, value, offset, littleEndian, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) { checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) } ieee754.write(buf, value, offset, littleEndian, 52, 8) return offset + 8 } Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { return writeDouble(this, value, offset, true, noAssert) } Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { return writeDouble(this, value, offset, false, noAssert) } // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) Buffer.prototype.copy = function copy (target, targetStart, start, end) { if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer') if (!start) start = 0 if (!end && end !== 0) end = this.length if (targetStart >= target.length) targetStart = target.length if (!targetStart) targetStart = 0 if (end > 0 && end < start) end = start // Copy 0 bytes; we're done if (end === start) return 0 if (target.length === 0 || this.length === 0) return 0 // Fatal error conditions if (targetStart < 0) { throw new RangeError('targetStart out of bounds') } if (start < 0 || start >= this.length) throw new RangeError('Index out of range') if (end < 0) throw new RangeError('sourceEnd out of bounds') // Are we oob? if (end > this.length) end = this.length if (target.length - targetStart < end - start) { end = target.length - targetStart + start } const len = end - start if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') { // Use built-in when available, missing from IE11 this.copyWithin(targetStart, start, end) } else { Uint8Array.prototype.set.call( target, this.subarray(start, end), targetStart ) } return len } // Usage: // buffer.fill(number[, offset[, end]]) // buffer.fill(buffer[, offset[, end]]) // buffer.fill(string[, offset[, end]][, encoding]) Buffer.prototype.fill = function fill (val, start, end, encoding) { // Handle string cases: if (typeof val === 'string') { if (typeof start === 'string') { encoding = start start = 0 end = this.length } else if (typeof end === 'string') { encoding = end end = this.length } if (encoding !== undefined && typeof encoding !== 'string') { throw new TypeError('encoding must be a string') } if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { throw new TypeError('Unknown encoding: ' + encoding) } if (val.length === 1) { const code = val.charCodeAt(0) if ((encoding === 'utf8' && code < 128) || encoding === 'latin1') { // Fast path: If `val` fits into a single byte, use that numeric value. val = code } } } else if (typeof val === 'number') { val = val & 255 } else if (typeof val === 'boolean') { val = Number(val) } // Invalid ranges are not set to a default, so can range check early. if (start < 0 || this.length < start || this.length < end) { throw new RangeError('Out of range index') } if (end <= start) { return this } start = start >>> 0 end = end === undefined ? this.length : end >>> 0 if (!val) val = 0 let i if (typeof val === 'number') { for (i = start; i < end; ++i) { this[i] = val } } else { const bytes = Buffer.isBuffer(val) ? val : Buffer.from(val, encoding) const len = bytes.length if (len === 0) { throw new TypeError('The value "' + val + '" is invalid for argument "value"') } for (i = 0; i < end - start; ++i) { this[i + start] = bytes[i % len] } } return this } // CUSTOM ERRORS // ============= // Simplified versions from Node, changed for Buffer-only usage const errors = {} function E (sym, getMessage, Base) { errors[sym] = class NodeError extends Base { constructor () { super() Object.defineProperty(this, 'message', { value: getMessage.apply(this, arguments), writable: true, configurable: true }) // Add the error code to the name to include it in the stack trace. this.name = `${this.name} [${sym}]` // Access the stack to generate the error message including the error code // from the name. this.stack // eslint-disable-line no-unused-expressions // Reset the name to the actual name. delete this.name } get code () { return sym } set code (value) { Object.defineProperty(this, 'code', { configurable: true, enumerable: true, value, writable: true }) } toString () { return `${this.name} [${sym}]: ${this.message}` } } } E('ERR_BUFFER_OUT_OF_BOUNDS', function (name) { if (name) { return `${name} is outside of buffer bounds` } return 'Attempt to access memory outside buffer bounds' }, RangeError) E('ERR_INVALID_ARG_TYPE', function (name, actual) { return `The "${name}" argument must be of type number. Received type ${typeof actual}` }, TypeError) E('ERR_OUT_OF_RANGE', function (str, range, input) { let msg = `The value of "${str}" is out of range.` let received = input if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) { received = addNumericalSeparator(String(input)) } else if (typeof input === 'bigint') { received = String(input) if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) { received = addNumericalSeparator(received) } received += 'n' } msg += ` It must be ${range}. Received ${received}` return msg }, RangeError) function addNumericalSeparator (val) { let res = '' let i = val.length const start = val[0] === '-' ? 1 : 0 for (; i >= start + 4; i -= 3) { res = `_${val.slice(i - 3, i)}${res}` } return `${val.slice(0, i)}${res}` } // CHECK FUNCTIONS // =============== function checkBounds (buf, offset, byteLength) { validateNumber(offset, 'offset') if (buf[offset] === undefined || buf[offset + byteLength] === undefined) { boundsError(offset, buf.length - (byteLength + 1)) } } function checkIntBI (value, min, max, buf, offset, byteLength) { if (value > max || value < min) { const n = typeof min === 'bigint' ? 'n' : '' let range if (byteLength > 3) { if (min === 0 || min === BigInt(0)) { range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}` } else { range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` + `${(byteLength + 1) * 8 - 1}${n}` } } else { range = `>= ${min}${n} and <= ${max}${n}` } throw new errors.ERR_OUT_OF_RANGE('value', range, value) } checkBounds(buf, offset, byteLength) } function validateNumber (value, name) { if (typeof value !== 'number') { throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value) } } function boundsError (value, length, type) { if (Math.floor(value) !== value) { validateNumber(value, type) throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value) } if (length < 0) { throw new errors.ERR_BUFFER_OUT_OF_BOUNDS() } throw new errors.ERR_OUT_OF_RANGE(type || 'offset', `>= ${type ? 1 : 0} and <= ${length}`, value) } // HELPER FUNCTIONS // ================ const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g function base64clean (str) { // Node takes equal signs as end of the Base64 encoding str = str.split('=')[0] // Node strips out invalid characters like \n and \t from the string, base64-js does not str = str.trim().replace(INVALID_BASE64_RE, '') // Node converts strings with length < 2 to '' if (str.length < 2) return '' // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not while (str.length % 4 !== 0) { str = str + '=' } return str } function utf8ToBytes (string, units) { units = units || Infinity let codePoint const length = string.length let leadSurrogate = null const bytes = [] for (let i = 0; i < length; ++i) { codePoint = string.charCodeAt(i) // is surrogate component if (codePoint > 0xD7FF && codePoint < 0xE000) { // last char was a lead if (!leadSurrogate) { // no lead yet if (codePoint > 0xDBFF) { // unexpected trail if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) continue } else if (i + 1 === length) { // unpaired lead if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) continue } // valid lead leadSurrogate = codePoint continue } // 2 leads in a row if (codePoint < 0xDC00) { if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) leadSurrogate = codePoint continue } // valid surrogate pair codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 } else if (leadSurrogate) { // valid bmp char, but last char was a lead if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) } leadSurrogate = null // encode utf8 if (codePoint < 0x80) { if ((units -= 1) < 0) break bytes.push(codePoint) } else if (codePoint < 0x800) { if ((units -= 2) < 0) break bytes.push( codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80 ) } else if (codePoint < 0x10000) { if ((units -= 3) < 0) break bytes.push( codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80 ) } else if (codePoint < 0x110000) { if ((units -= 4) < 0) break bytes.push( codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80 ) } else { throw new Error('Invalid code point') } } return bytes } function asciiToBytes (str) { const byteArray = [] for (let i = 0; i < str.length; ++i) { // Node's code seems to be doing this and not & 0x7F.. byteArray.push(str.charCodeAt(i) & 0xFF) } return byteArray } function utf16leToBytes (str, units) { let c, hi, lo const byteArray = [] for (let i = 0; i < str.length; ++i) { if ((units -= 2) < 0) break c = str.charCodeAt(i) hi = c >> 8 lo = c % 256 byteArray.push(lo) byteArray.push(hi) } return byteArray } function base64ToBytes (str) { return base64.toByteArray(base64clean(str)) } function blitBuffer (src, dst, offset, length) { let i for (i = 0; i < length; ++i) { if ((i + offset >= dst.length) || (i >= src.length)) break dst[i + offset] = src[i] } return i } // ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass // the `instanceof` check but they should be treated as of that type. // See: https://github.com/feross/buffer/issues/166 function isInstance (obj, type) { return obj instanceof type || (obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name) } function numberIsNaN (obj) { // For IE11 support return obj !== obj // eslint-disable-line no-self-compare } // Create lookup table for `toString('hex')` // See: https://github.com/feross/buffer/issues/219 const hexSliceLookupTable = (function () { const alphabet = '0123456789abcdef' const table = new Array(256) for (let i = 0; i < 16; ++i) { const i16 = i * 16 for (let j = 0; j < 16; ++j) { table[i16 + j] = alphabet[i] + alphabet[j] } } return table })() // Return not function with Error if BigInt not supported function defineBigIntMethod (fn) { return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn } function BufferBigIntNotDefined () { throw new Error('BigInt not supported') } /***/ }), /***/ 54098: /***/ (function(module, exports) { var global = typeof self !== 'undefined' ? self : this; var __self__ = (function () { function F() { this.fetch = false; this.DOMException = global.DOMException } F.prototype = global; return new F(); })(); (function(self) { var irrelevant = (function (exports) { var support = { searchParams: 'URLSearchParams' in self, iterable: 'Symbol' in self && 'iterator' in Symbol, blob: 'FileReader' in self && 'Blob' in self && (function() { try { new Blob(); return true } catch (e) { return false } })(), formData: 'FormData' in self, arrayBuffer: 'ArrayBuffer' in self }; function isDataView(obj) { return obj && DataView.prototype.isPrototypeOf(obj) } if (support.arrayBuffer) { var viewClasses = [ '[object Int8Array]', '[object Uint8Array]', '[object Uint8ClampedArray]', '[object Int16Array]', '[object Uint16Array]', '[object Int32Array]', '[object Uint32Array]', '[object Float32Array]', '[object Float64Array]' ]; var isArrayBufferView = ArrayBuffer.isView || function(obj) { return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1 }; } function normalizeName(name) { if (typeof name !== 'string') { name = String(name); } if (/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(name)) { throw new TypeError('Invalid character in header field name') } return name.toLowerCase() } function normalizeValue(value) { if (typeof value !== 'string') { value = String(value); } return value } // Build a destructive iterator for the value list function iteratorFor(items) { var iterator = { next: function() { var value = items.shift(); return {done: value === undefined, value: value} } }; if (support.iterable) { iterator[Symbol.iterator] = function() { return iterator }; } return iterator } function Headers(headers) { this.map = {}; if (headers instanceof Headers) { headers.forEach(function(value, name) { this.append(name, value); }, this); } else if (Array.isArray(headers)) { headers.forEach(function(header) { this.append(header[0], header[1]); }, this); } else if (headers) { Object.getOwnPropertyNames(headers).forEach(function(name) { this.append(name, headers[name]); }, this); } } Headers.prototype.append = function(name, value) { name = normalizeName(name); value = normalizeValue(value); var oldValue = this.map[name]; this.map[name] = oldValue ? oldValue + ', ' + value : value; }; Headers.prototype['delete'] = function(name) { delete this.map[normalizeName(name)]; }; Headers.prototype.get = function(name) { name = normalizeName(name); return this.has(name) ? this.map[name] : null }; Headers.prototype.has = function(name) { return this.map.hasOwnProperty(normalizeName(name)) }; Headers.prototype.set = function(name, value) { this.map[normalizeName(name)] = normalizeValue(value); }; Headers.prototype.forEach = function(callback, thisArg) { for (var name in this.map) { if (this.map.hasOwnProperty(name)) { callback.call(thisArg, this.map[name], name, this); } } }; Headers.prototype.keys = function() { var items = []; this.forEach(function(value, name) { items.push(name); }); return iteratorFor(items) }; Headers.prototype.values = function() { var items = []; this.forEach(function(value) { items.push(value); }); return iteratorFor(items) }; Headers.prototype.entries = function() { var items = []; this.forEach(function(value, name) { items.push([name, value]); }); return iteratorFor(items) }; if (support.iterable) { Headers.prototype[Symbol.iterator] = Headers.prototype.entries; } function consumed(body) { if (body.bodyUsed) { return Promise.reject(new TypeError('Already read')) } body.bodyUsed = true; } function fileReaderReady(reader) { return new Promise(function(resolve, reject) { reader.onload = function() { resolve(reader.result); }; reader.onerror = function() { reject(reader.error); }; }) } function readBlobAsArrayBuffer(blob) { var reader = new FileReader(); var promise = fileReaderReady(reader); reader.readAsArrayBuffer(blob); return promise } function readBlobAsText(blob) { var reader = new FileReader(); var promise = fileReaderReady(reader); reader.readAsText(blob); return promise } function readArrayBufferAsText(buf) { var view = new Uint8Array(buf); var chars = new Array(view.length); for (var i = 0; i < view.length; i++) { chars[i] = String.fromCharCode(view[i]); } return chars.join('') } function bufferClone(buf) { if (buf.slice) { return buf.slice(0) } else { var view = new Uint8Array(buf.byteLength); view.set(new Uint8Array(buf)); return view.buffer } } function Body() { this.bodyUsed = false; this._initBody = function(body) { this._bodyInit = body; if (!body) { this._bodyText = ''; } else if (typeof body === 'string') { this._bodyText = body; } else if (support.blob && Blob.prototype.isPrototypeOf(body)) { this._bodyBlob = body; } else if (support.formData && FormData.prototype.isPrototypeOf(body)) { this._bodyFormData = body; } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { this._bodyText = body.toString(); } else if (support.arrayBuffer && support.blob && isDataView(body)) { this._bodyArrayBuffer = bufferClone(body.buffer); // IE 10-11 can't handle a DataView body. this._bodyInit = new Blob([this._bodyArrayBuffer]); } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) { this._bodyArrayBuffer = bufferClone(body); } else { this._bodyText = body = Object.prototype.toString.call(body); } if (!this.headers.get('content-type')) { if (typeof body === 'string') { this.headers.set('content-type', 'text/plain;charset=UTF-8'); } else if (this._bodyBlob && this._bodyBlob.type) { this.headers.set('content-type', this._bodyBlob.type); } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8'); } } }; if (support.blob) { this.blob = function() { var rejected = consumed(this); if (rejected) { return rejected } if (this._bodyBlob) { return Promise.resolve(this._bodyBlob) } else if (this._bodyArrayBuffer) { return Promise.resolve(new Blob([this._bodyArrayBuffer])) } else if (this._bodyFormData) { throw new Error('could not read FormData body as blob') } else { return Promise.resolve(new Blob([this._bodyText])) } }; this.arrayBuffer = function() { if (this._bodyArrayBuffer) { return consumed(this) || Promise.resolve(this._bodyArrayBuffer) } else { return this.blob().then(readBlobAsArrayBuffer) } }; } this.text = function() { var rejected = consumed(this); if (rejected) { return rejected } if (this._bodyBlob) { return readBlobAsText(this._bodyBlob) } else if (this._bodyArrayBuffer) { return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer)) } else if (this._bodyFormData) { throw new Error('could not read FormData body as text') } else { return Promise.resolve(this._bodyText) } }; if (support.formData) { this.formData = function() { return this.text().then(decode) }; } this.json = function() { return this.text().then(JSON.parse) }; return this } // HTTP methods whose capitalization should be normalized var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']; function normalizeMethod(method) { var upcased = method.toUpperCase(); return methods.indexOf(upcased) > -1 ? upcased : method } function Request(input, options) { options = options || {}; var body = options.body; if (input instanceof Request) { if (input.bodyUsed) { throw new TypeError('Already read') } this.url = input.url; this.credentials = input.credentials; if (!options.headers) { this.headers = new Headers(input.headers); } this.method = input.method; this.mode = input.mode; this.signal = input.signal; if (!body && input._bodyInit != null) { body = input._bodyInit; input.bodyUsed = true; } } else { this.url = String(input); } this.credentials = options.credentials || this.credentials || 'same-origin'; if (options.headers || !this.headers) { this.headers = new Headers(options.headers); } this.method = normalizeMethod(options.method || this.method || 'GET'); this.mode = options.mode || this.mode || null; this.signal = options.signal || this.signal; this.referrer = null; if ((this.method === 'GET' || this.method === 'HEAD') && body) { throw new TypeError('Body not allowed for GET or HEAD requests') } this._initBody(body); } Request.prototype.clone = function() { return new Request(this, {body: this._bodyInit}) }; function decode(body) { var form = new FormData(); body .trim() .split('&') .forEach(function(bytes) { if (bytes) { var split = bytes.split('='); var name = split.shift().replace(/\+/g, ' '); var value = split.join('=').replace(/\+/g, ' '); form.append(decodeURIComponent(name), decodeURIComponent(value)); } }); return form } function parseHeaders(rawHeaders) { var headers = new Headers(); // Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space // https://tools.ietf.org/html/rfc7230#section-3.2 var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' '); preProcessedHeaders.split(/\r?\n/).forEach(function(line) { var parts = line.split(':'); var key = parts.shift().trim(); if (key) { var value = parts.join(':').trim(); headers.append(key, value); } }); return headers } Body.call(Request.prototype); function Response(bodyInit, options) { if (!options) { options = {}; } this.type = 'default'; this.status = options.status === undefined ? 200 : options.status; this.ok = this.status >= 200 && this.status < 300; this.statusText = 'statusText' in options ? options.statusText : 'OK'; this.headers = new Headers(options.headers); this.url = options.url || ''; this._initBody(bodyInit); } Body.call(Response.prototype); Response.prototype.clone = function() { return new Response(this._bodyInit, { status: this.status, statusText: this.statusText, headers: new Headers(this.headers), url: this.url }) }; Response.error = function() { var response = new Response(null, {status: 0, statusText: ''}); response.type = 'error'; return response }; var redirectStatuses = [301, 302, 303, 307, 308]; Response.redirect = function(url, status) { if (redirectStatuses.indexOf(status) === -1) { throw new RangeError('Invalid status code') } return new Response(null, {status: status, headers: {location: url}}) }; exports.DOMException = self.DOMException; try { new exports.DOMException(); } catch (err) { exports.DOMException = function(message, name) { this.message = message; this.name = name; var error = Error(message); this.stack = error.stack; }; exports.DOMException.prototype = Object.create(Error.prototype); exports.DOMException.prototype.constructor = exports.DOMException; } function fetch(input, init) { return new Promise(function(resolve, reject) { var request = new Request(input, init); if (request.signal && request.signal.aborted) { return reject(new exports.DOMException('Aborted', 'AbortError')) } var xhr = new XMLHttpRequest(); function abortXhr() { xhr.abort(); } xhr.onload = function() { var options = { status: xhr.status, statusText: xhr.statusText, headers: parseHeaders(xhr.getAllResponseHeaders() || '') }; options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL'); var body = 'response' in xhr ? xhr.response : xhr.responseText; resolve(new Response(body, options)); }; xhr.onerror = function() { reject(new TypeError('Network request failed')); }; xhr.ontimeout = function() { reject(new TypeError('Network request failed')); }; xhr.onabort = function() { reject(new exports.DOMException('Aborted', 'AbortError')); }; xhr.open(request.method, request.url, true); if (request.credentials === 'include') { xhr.withCredentials = true; } else if (request.credentials === 'omit') { xhr.withCredentials = false; } if ('responseType' in xhr && support.blob) { xhr.responseType = 'blob'; } request.headers.forEach(function(value, name) { xhr.setRequestHeader(name, value); }); if (request.signal) { request.signal.addEventListener('abort', abortXhr); xhr.onreadystatechange = function() { // DONE (success or failure) if (xhr.readyState === 4) { request.signal.removeEventListener('abort', abortXhr); } }; } xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit); }) } fetch.polyfill = true; if (!self.fetch) { self.fetch = fetch; self.Headers = Headers; self.Request = Request; self.Response = Response; } exports.Headers = Headers; exports.Request = Request; exports.Response = Response; exports.fetch = fetch; Object.defineProperty(exports, '__esModule', { value: true }); return exports; })({}); })(__self__); __self__.fetch.ponyfill = true; // Remove "polyfill" property added by whatwg-fetch delete __self__.fetch.polyfill; // Choose between native implementation (global) or custom implementation (__self__) // var ctx = global.fetch ? global : __self__; var ctx = __self__; // this line disable service worker support temporarily exports = ctx.fetch // To enable: import fetch from 'cross-fetch' exports["default"] = ctx.fetch // For TypeScript consumers without esModuleInterop. exports.fetch = ctx.fetch // To enable: import {fetch} from 'cross-fetch' exports.Headers = ctx.Headers exports.Request = ctx.Request exports.Response = ctx.Response module.exports = exports /***/ }), /***/ 13882: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Z": function() { return /* binding */ requiredArgs; } /* harmony export */ }); function requiredArgs(required, args) { if (args.length < required) { throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present'); } } /***/ }), /***/ 19013: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Z": function() { return /* binding */ toDate; } /* harmony export */ }); /* harmony import */ var _lib_requiredArgs_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(13882); /** * @name toDate * @category Common Helpers * @summary Convert the given argument to an instance of Date. * * @description * Convert the given argument to an instance of Date. * * If the argument is an instance of Date, the function returns its clone. * * If the argument is a number, it is treated as a timestamp. * * If the argument is none of the above, the function returns Invalid Date. * * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`. * * @param {Date|Number} argument - the value to convert * @returns {Date} the parsed date in the local time zone * @throws {TypeError} 1 argument required * * @example * // Clone the date: * const result = toDate(new Date(2014, 1, 11, 11, 30, 30)) * //=> Tue Feb 11 2014 11:30:30 * * @example * // Convert the timestamp to date: * const result = toDate(1392098430000) * //=> Tue Feb 11 2014 11:30:30 */ function toDate(argument) { (0,_lib_requiredArgs_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(1, arguments); var argStr = Object.prototype.toString.call(argument); // Clone the date if (argument instanceof Date || typeof argument === 'object' && argStr === '[object Date]') { // Prevent the date to lose the milliseconds when passed to new Date() in IE10 return new Date(argument.getTime()); } else if (typeof argument === 'number' || argStr === '[object Number]') { return new Date(argument); } else { if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') { // eslint-disable-next-line no-console console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"); // eslint-disable-next-line no-console console.warn(new Error().stack); } return new Date(NaN); } } /***/ }), /***/ 29887: /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_RESULT__;/*! decimal.js-light v2.5.1 https://github.com/MikeMcl/decimal.js-light/LICENCE */ ;(function (globalScope) { 'use strict'; /* * decimal.js-light v2.5.1 * An arbitrary-precision Decimal type for JavaScript. * https://github.com/MikeMcl/decimal.js-light * Copyright (c) 2020 Michael Mclaughlin * MIT Expat Licence */ // ----------------------------------- EDITABLE DEFAULTS ------------------------------------ // // The limit on the value of `precision`, and on the value of the first argument to // `toDecimalPlaces`, `toExponential`, `toFixed`, `toPrecision` and `toSignificantDigits`. var MAX_DIGITS = 1e9, // 0 to 1e9 // The initial configuration properties of the Decimal constructor. Decimal = { // These values must be integers within the stated ranges (inclusive). // Most of these values can be changed during run-time using `Decimal.config`. // The maximum number of significant digits of the result of a calculation or base conversion. // E.g. `Decimal.config({ precision: 20 });` precision: 20, // 1 to MAX_DIGITS // The rounding mode used by default by `toInteger`, `toDecimalPlaces`, `toExponential`, // `toFixed`, `toPrecision` and `toSignificantDigits`. // // ROUND_UP 0 Away from zero. // ROUND_DOWN 1 Towards zero. // ROUND_CEIL 2 Towards +Infinity. // ROUND_FLOOR 3 Towards -Infinity. // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up. // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down. // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour. // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity. // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity. // // E.g. // `Decimal.rounding = 4;` // `Decimal.rounding = Decimal.ROUND_HALF_UP;` rounding: 4, // 0 to 8 // The exponent value at and beneath which `toString` returns exponential notation. // JavaScript numbers: -7 toExpNeg: -7, // 0 to -MAX_E // The exponent value at and above which `toString` returns exponential notation. // JavaScript numbers: 21 toExpPos: 21, // 0 to MAX_E // The natural logarithm of 10. // 115 digits LN10: '2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286' }, // ----------------------------------- END OF EDITABLE DEFAULTS ------------------------------- // external = true, decimalError = '[DecimalError] ', invalidArgument = decimalError + 'Invalid argument: ', exponentOutOfRange = decimalError + 'Exponent out of range: ', mathfloor = Math.floor, mathpow = Math.pow, isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, ONE, BASE = 1e7, LOG_BASE = 7, MAX_SAFE_INTEGER = 9007199254740991, MAX_E = mathfloor(MAX_SAFE_INTEGER / LOG_BASE), // 1286742750677284 // Decimal.prototype object P = {}; // Decimal prototype methods /* * absoluteValue abs * comparedTo cmp * decimalPlaces dp * dividedBy div * dividedToIntegerBy idiv * equals eq * exponent * greaterThan gt * greaterThanOrEqualTo gte * isInteger isint * isNegative isneg * isPositive ispos * isZero * lessThan lt * lessThanOrEqualTo lte * logarithm log * minus sub * modulo mod * naturalExponential exp * naturalLogarithm ln * negated neg * plus add * precision sd * squareRoot sqrt * times mul * toDecimalPlaces todp * toExponential * toFixed * toInteger toint * toNumber * toPower pow * toPrecision * toSignificantDigits tosd * toString * valueOf val */ /* * Return a new Decimal whose value is the absolute value of this Decimal. * */ P.absoluteValue = P.abs = function () { var x = new this.constructor(this); if (x.s) x.s = 1; return x; }; /* * Return * 1 if the value of this Decimal is greater than the value of `y`, * -1 if the value of this Decimal is less than the value of `y`, * 0 if they have the same value * */ P.comparedTo = P.cmp = function (y) { var i, j, xdL, ydL, x = this; y = new x.constructor(y); // Signs differ? if (x.s !== y.s) return x.s || -y.s; // Compare exponents. if (x.e !== y.e) return x.e > y.e ^ x.s < 0 ? 1 : -1; xdL = x.d.length; ydL = y.d.length; // Compare digit by digit. for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) { if (x.d[i] !== y.d[i]) return x.d[i] > y.d[i] ^ x.s < 0 ? 1 : -1; } // Compare lengths. return xdL === ydL ? 0 : xdL > ydL ^ x.s < 0 ? 1 : -1; }; /* * Return the number of decimal places of the value of this Decimal. * */ P.decimalPlaces = P.dp = function () { var x = this, w = x.d.length - 1, dp = (w - x.e) * LOG_BASE; // Subtract the number of trailing zeros of the last word. w = x.d[w]; if (w) for (; w % 10 == 0; w /= 10) dp--; return dp < 0 ? 0 : dp; }; /* * Return a new Decimal whose value is the value of this Decimal divided by `y`, truncated to * `precision` significant digits. * */ P.dividedBy = P.div = function (y) { return divide(this, new this.constructor(y)); }; /* * Return a new Decimal whose value is the integer part of dividing the value of this Decimal * by the value of `y`, truncated to `precision` significant digits. * */ P.dividedToIntegerBy = P.idiv = function (y) { var x = this, Ctor = x.constructor; return round(divide(x, new Ctor(y), 0, 1), Ctor.precision); }; /* * Return true if the value of this Decimal is equal to the value of `y`, otherwise return false. * */ P.equals = P.eq = function (y) { return !this.cmp(y); }; /* * Return the (base 10) exponent value of this Decimal (this.e is the base 10000000 exponent). * */ P.exponent = function () { return getBase10Exponent(this); }; /* * Return true if the value of this Decimal is greater than the value of `y`, otherwise return * false. * */ P.greaterThan = P.gt = function (y) { return this.cmp(y) > 0; }; /* * Return true if the value of this Decimal is greater than or equal to the value of `y`, * otherwise return false. * */ P.greaterThanOrEqualTo = P.gte = function (y) { return this.cmp(y) >= 0; }; /* * Return true if the value of this Decimal is an integer, otherwise return false. * */ P.isInteger = P.isint = function () { return this.e > this.d.length - 2; }; /* * Return true if the value of this Decimal is negative, otherwise return false. * */ P.isNegative = P.isneg = function () { return this.s < 0; }; /* * Return true if the value of this Decimal is positive, otherwise return false. * */ P.isPositive = P.ispos = function () { return this.s > 0; }; /* * Return true if the value of this Decimal is 0, otherwise return false. * */ P.isZero = function () { return this.s === 0; }; /* * Return true if the value of this Decimal is less than `y`, otherwise return false. * */ P.lessThan = P.lt = function (y) { return this.cmp(y) < 0; }; /* * Return true if the value of this Decimal is less than or equal to `y`, otherwise return false. * */ P.lessThanOrEqualTo = P.lte = function (y) { return this.cmp(y) < 1; }; /* * Return the logarithm of the value of this Decimal to the specified base, truncated to * `precision` significant digits. * * If no base is specified, return log[10](x). * * log[base](x) = ln(x) / ln(base) * * The maximum error of the result is 1 ulp (unit in the last place). * * [base] {number|string|Decimal} The base of the logarithm. * */ P.logarithm = P.log = function (base) { var r, x = this, Ctor = x.constructor, pr = Ctor.precision, wpr = pr + 5; // Default base is 10. if (base === void 0) { base = new Ctor(10); } else { base = new Ctor(base); // log[-b](x) = NaN // log[0](x) = NaN // log[1](x) = NaN if (base.s < 1 || base.eq(ONE)) throw Error(decimalError + 'NaN'); } // log[b](-x) = NaN // log[b](0) = -Infinity if (x.s < 1) throw Error(decimalError + (x.s ? 'NaN' : '-Infinity')); // log[b](1) = 0 if (x.eq(ONE)) return new Ctor(0); external = false; r = divide(ln(x, wpr), ln(base, wpr), wpr); external = true; return round(r, pr); }; /* * Return a new Decimal whose value is the value of this Decimal minus `y`, truncated to * `precision` significant digits. * */ P.minus = P.sub = function (y) { var x = this; y = new x.constructor(y); return x.s == y.s ? subtract(x, y) : add(x, (y.s = -y.s, y)); }; /* * Return a new Decimal whose value is the value of this Decimal modulo `y`, truncated to * `precision` significant digits. * */ P.modulo = P.mod = function (y) { var q, x = this, Ctor = x.constructor, pr = Ctor.precision; y = new Ctor(y); // x % 0 = NaN if (!y.s) throw Error(decimalError + 'NaN'); // Return x if x is 0. if (!x.s) return round(new Ctor(x), pr); // Prevent rounding of intermediate calculations. external = false; q = divide(x, y, 0, 1).times(y); external = true; return x.minus(q); }; /* * Return a new Decimal whose value is the natural exponential of the value of this Decimal, * i.e. the base e raised to the power the value of this Decimal, truncated to `precision` * significant digits. * */ P.naturalExponential = P.exp = function () { return exp(this); }; /* * Return a new Decimal whose value is the natural logarithm of the value of this Decimal, * truncated to `precision` significant digits. * */ P.naturalLogarithm = P.ln = function () { return ln(this); }; /* * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by * -1. * */ P.negated = P.neg = function () { var x = new this.constructor(this); x.s = -x.s || 0; return x; }; /* * Return a new Decimal whose value is the value of this Decimal plus `y`, truncated to * `precision` significant digits. * */ P.plus = P.add = function (y) { var x = this; y = new x.constructor(y); return x.s == y.s ? add(x, y) : subtract(x, (y.s = -y.s, y)); }; /* * Return the number of significant digits of the value of this Decimal. * * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0. * */ P.precision = P.sd = function (z) { var e, sd, w, x = this; if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z); e = getBase10Exponent(x) + 1; w = x.d.length - 1; sd = w * LOG_BASE + 1; w = x.d[w]; // If non-zero... if (w) { // Subtract the number of trailing zeros of the last word. for (; w % 10 == 0; w /= 10) sd--; // Add the number of digits of the first word. for (w = x.d[0]; w >= 10; w /= 10) sd++; } return z && e > sd ? e : sd; }; /* * Return a new Decimal whose value is the square root of this Decimal, truncated to `precision` * significant digits. * */ P.squareRoot = P.sqrt = function () { var e, n, pr, r, s, t, wpr, x = this, Ctor = x.constructor; // Negative or zero? if (x.s < 1) { if (!x.s) return new Ctor(0); // sqrt(-x) = NaN throw Error(decimalError + 'NaN'); } e = getBase10Exponent(x); external = false; // Initial estimate. s = Math.sqrt(+x); // Math.sqrt underflow/overflow? // Pass x to Math.sqrt as integer, then adjust the exponent of the result. if (s == 0 || s == 1 / 0) { n = digitsToString(x.d); if ((n.length + e) % 2 == 0) n += '0'; s = Math.sqrt(n); e = mathfloor((e + 1) / 2) - (e < 0 || e % 2); if (s == 1 / 0) { n = '5e' + e; } else { n = s.toExponential(); n = n.slice(0, n.indexOf('e') + 1) + e; } r = new Ctor(n); } else { r = new Ctor(s.toString()); } pr = Ctor.precision; s = wpr = pr + 3; // Newton-Raphson iteration. for (;;) { t = r; r = t.plus(divide(x, t, wpr + 2)).times(0.5); if (digitsToString(t.d).slice(0, wpr) === (n = digitsToString(r.d)).slice(0, wpr)) { n = n.slice(wpr - 3, wpr + 1); // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or // 4999, i.e. approaching a rounding boundary, continue the iteration. if (s == wpr && n == '4999') { // On the first iteration only, check to see if rounding up gives the exact result as the // nines may infinitely repeat. round(t, pr + 1, 0); if (t.times(t).eq(x)) { r = t; break; } } else if (n != '9999') { break; } wpr += 4; } } external = true; return round(r, pr); }; /* * Return a new Decimal whose value is the value of this Decimal times `y`, truncated to * `precision` significant digits. * */ P.times = P.mul = function (y) { var carry, e, i, k, r, rL, t, xdL, ydL, x = this, Ctor = x.constructor, xd = x.d, yd = (y = new Ctor(y)).d; // Return 0 if either is 0. if (!x.s || !y.s) return new Ctor(0); y.s *= x.s; e = x.e + y.e; xdL = xd.length; ydL = yd.length; // Ensure xd points to the longer array. if (xdL < ydL) { r = xd; xd = yd; yd = r; rL = xdL; xdL = ydL; ydL = rL; } // Initialise the result array with zeros. r = []; rL = xdL + ydL; for (i = rL; i--;) r.push(0); // Multiply! for (i = ydL; --i >= 0;) { carry = 0; for (k = xdL + i; k > i;) { t = r[k] + yd[i] * xd[k - i - 1] + carry; r[k--] = t % BASE | 0; carry = t / BASE | 0; } r[k] = (r[k] + carry) % BASE | 0; } // Remove trailing zeros. for (; !r[--rL];) r.pop(); if (carry) ++e; else r.shift(); y.d = r; y.e = e; return external ? round(y, Ctor.precision) : y; }; /* * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `dp` * decimal places using rounding mode `rm` or `rounding` if `rm` is omitted. * * If `dp` is omitted, return a new Decimal whose value is the value of this Decimal. * * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. * */ P.toDecimalPlaces = P.todp = function (dp, rm) { var x = this, Ctor = x.constructor; x = new Ctor(x); if (dp === void 0) return x; checkInt32(dp, 0, MAX_DIGITS); if (rm === void 0) rm = Ctor.rounding; else checkInt32(rm, 0, 8); return round(x, dp + getBase10Exponent(x) + 1, rm); }; /* * Return a string representing the value of this Decimal in exponential notation rounded to * `dp` fixed decimal places using rounding mode `rounding`. * * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. * */ P.toExponential = function (dp, rm) { var str, x = this, Ctor = x.constructor; if (dp === void 0) { str = toString(x, true); } else { checkInt32(dp, 0, MAX_DIGITS); if (rm === void 0) rm = Ctor.rounding; else checkInt32(rm, 0, 8); x = round(new Ctor(x), dp + 1, rm); str = toString(x, true, dp + 1); } return str; }; /* * Return a string representing the value of this Decimal in normal (fixed-point) notation to * `dp` fixed decimal places and rounded using rounding mode `rm` or `rounding` if `rm` is * omitted. * * As with JavaScript numbers, (-0).toFixed(0) is '0', but e.g. (-0.00001).toFixed(0) is '-0'. * * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. * * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'. * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'. * (-0).toFixed(3) is '0.000'. * (-0.5).toFixed(0) is '-0'. * */ P.toFixed = function (dp, rm) { var str, y, x = this, Ctor = x.constructor; if (dp === void 0) return toString(x); checkInt32(dp, 0, MAX_DIGITS); if (rm === void 0) rm = Ctor.rounding; else checkInt32(rm, 0, 8); y = round(new Ctor(x), dp + getBase10Exponent(x) + 1, rm); str = toString(y.abs(), false, dp + getBase10Exponent(y) + 1); // To determine whether to add the minus sign look at the value before it was rounded, // i.e. look at `x` rather than `y`. return x.isneg() && !x.isZero() ? '-' + str : str; }; /* * Return a new Decimal whose value is the value of this Decimal rounded to a whole number using * rounding mode `rounding`. * */ P.toInteger = P.toint = function () { var x = this, Ctor = x.constructor; return round(new Ctor(x), getBase10Exponent(x) + 1, Ctor.rounding); }; /* * Return the value of this Decimal converted to a number primitive. * */ P.toNumber = function () { return +this; }; /* * Return a new Decimal whose value is the value of this Decimal raised to the power `y`, * truncated to `precision` significant digits. * * For non-integer or very large exponents pow(x, y) is calculated using * * x^y = exp(y*ln(x)) * * The maximum error is 1 ulp (unit in last place). * * y {number|string|Decimal} The power to which to raise this Decimal. * */ P.toPower = P.pow = function (y) { var e, k, pr, r, sign, yIsInt, x = this, Ctor = x.constructor, guard = 12, yn = +(y = new Ctor(y)); // pow(x, 0) = 1 if (!y.s) return new Ctor(ONE); x = new Ctor(x); // pow(0, y > 0) = 0 // pow(0, y < 0) = Infinity if (!x.s) { if (y.s < 1) throw Error(decimalError + 'Infinity'); return x; } // pow(1, y) = 1 if (x.eq(ONE)) return x; pr = Ctor.precision; // pow(x, 1) = x if (y.eq(ONE)) return round(x, pr); e = y.e; k = y.d.length - 1; yIsInt = e >= k; sign = x.s; if (!yIsInt) { // pow(x < 0, y non-integer) = NaN if (sign < 0) throw Error(decimalError + 'NaN'); // If y is a small integer use the 'exponentiation by squaring' algorithm. } else if ((k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) { r = new Ctor(ONE); // Max k of 9007199254740991 takes 53 loop iterations. // Maximum digits array length; leaves [28, 34] guard digits. e = Math.ceil(pr / LOG_BASE + 4); external = false; for (;;) { if (k % 2) { r = r.times(x); truncate(r.d, e); } k = mathfloor(k / 2); if (k === 0) break; x = x.times(x); truncate(x.d, e); } external = true; return y.s < 0 ? new Ctor(ONE).div(r) : round(r, pr); } // Result is negative if x is negative and the last digit of integer y is odd. sign = sign < 0 && y.d[Math.max(e, k)] & 1 ? -1 : 1; x.s = 1; external = false; r = y.times(ln(x, pr + guard)); external = true; r = exp(r); r.s = sign; return r; }; /* * Return a string representing the value of this Decimal rounded to `sd` significant digits * using rounding mode `rounding`. * * Return exponential notation if `sd` is less than the number of digits necessary to represent * the integer part of the value in normal notation. * * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. * */ P.toPrecision = function (sd, rm) { var e, str, x = this, Ctor = x.constructor; if (sd === void 0) { e = getBase10Exponent(x); str = toString(x, e <= Ctor.toExpNeg || e >= Ctor.toExpPos); } else { checkInt32(sd, 1, MAX_DIGITS); if (rm === void 0) rm = Ctor.rounding; else checkInt32(rm, 0, 8); x = round(new Ctor(x), sd, rm); e = getBase10Exponent(x); str = toString(x, sd <= e || e <= Ctor.toExpNeg, sd); } return str; }; /* * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `sd` * significant digits using rounding mode `rm`, or to `precision` and `rounding` respectively if * omitted. * * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. * */ P.toSignificantDigits = P.tosd = function (sd, rm) { var x = this, Ctor = x.constructor; if (sd === void 0) { sd = Ctor.precision; rm = Ctor.rounding; } else { checkInt32(sd, 1, MAX_DIGITS); if (rm === void 0) rm = Ctor.rounding; else checkInt32(rm, 0, 8); } return round(new Ctor(x), sd, rm); }; /* * Return a string representing the value of this Decimal. * * Return exponential notation if this Decimal has a positive exponent equal to or greater than * `toExpPos`, or a negative exponent equal to or less than `toExpNeg`. * */ P.toString = P.valueOf = P.val = P.toJSON = function () { var x = this, e = getBase10Exponent(x), Ctor = x.constructor; return toString(x, e <= Ctor.toExpNeg || e >= Ctor.toExpPos); }; // Helper functions for Decimal.prototype (P) and/or Decimal methods, and their callers. /* * add P.minus, P.plus * checkInt32 P.todp, P.toExponential, P.toFixed, P.toPrecision, P.tosd * digitsToString P.log, P.sqrt, P.pow, toString, exp, ln * divide P.div, P.idiv, P.log, P.mod, P.sqrt, exp, ln * exp P.exp, P.pow * getBase10Exponent P.exponent, P.sd, P.toint, P.sqrt, P.todp, P.toFixed, P.toPrecision, * P.toString, divide, round, toString, exp, ln * getLn10 P.log, ln * getZeroString digitsToString, toString * ln P.log, P.ln, P.pow, exp * parseDecimal Decimal * round P.abs, P.idiv, P.log, P.minus, P.mod, P.neg, P.plus, P.toint, P.sqrt, * P.times, P.todp, P.toExponential, P.toFixed, P.pow, P.toPrecision, P.tosd, * divide, getLn10, exp, ln * subtract P.minus, P.plus * toString P.toExponential, P.toFixed, P.toPrecision, P.toString, P.valueOf * truncate P.pow * * Throws: P.log, P.mod, P.sd, P.sqrt, P.pow, checkInt32, divide, round, * getLn10, exp, ln, parseDecimal, Decimal, config */ function add(x, y) { var carry, d, e, i, k, len, xd, yd, Ctor = x.constructor, pr = Ctor.precision; // If either is zero... if (!x.s || !y.s) { // Return x if y is zero. // Return y if y is non-zero. if (!y.s) y = new Ctor(x); return external ? round(y, pr) : y; } xd = x.d; yd = y.d; // x and y are finite, non-zero numbers with the same sign. k = x.e; e = y.e; xd = xd.slice(); i = k - e; // If base 1e7 exponents differ... if (i) { if (i < 0) { d = xd; i = -i; len = yd.length; } else { d = yd; e = k; len = xd.length; } // Limit number of zeros prepended to max(ceil(pr / LOG_BASE), len) + 1. k = Math.ceil(pr / LOG_BASE); len = k > len ? k + 1 : len + 1; if (i > len) { i = len; d.length = 1; } // Prepend zeros to equalise exponents. Note: Faster to use reverse then do unshifts. d.reverse(); for (; i--;) d.push(0); d.reverse(); } len = xd.length; i = yd.length; // If yd is longer than xd, swap xd and yd so xd points to the longer array. if (len - i < 0) { i = len; d = yd; yd = xd; xd = d; } // Only start adding at yd.length - 1 as the further digits of xd can be left as they are. for (carry = 0; i;) { carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0; xd[i] %= BASE; } if (carry) { xd.unshift(carry); ++e; } // Remove trailing zeros. // No need to check for zero, as +x + +y != 0 && -x + -y != 0 for (len = xd.length; xd[--len] == 0;) xd.pop(); y.d = xd; y.e = e; return external ? round(y, pr) : y; } function checkInt32(i, min, max) { if (i !== ~~i || i < min || i > max) { throw Error(invalidArgument + i); } } function digitsToString(d) { var i, k, ws, indexOfLastWord = d.length - 1, str = '', w = d[0]; if (indexOfLastWord > 0) { str += w; for (i = 1; i < indexOfLastWord; i++) { ws = d[i] + ''; k = LOG_BASE - ws.length; if (k) str += getZeroString(k); str += ws; } w = d[i]; ws = w + ''; k = LOG_BASE - ws.length; if (k) str += getZeroString(k); } else if (w === 0) { return '0'; } // Remove trailing zeros of last w. for (; w % 10 === 0;) w /= 10; return str + w; } var divide = (function () { // Assumes non-zero x and k, and hence non-zero result. function multiplyInteger(x, k) { var temp, carry = 0, i = x.length; for (x = x.slice(); i--;) { temp = x[i] * k + carry; x[i] = temp % BASE | 0; carry = temp / BASE | 0; } if (carry) x.unshift(carry); return x; } function compare(a, b, aL, bL) { var i, r; if (aL != bL) { r = aL > bL ? 1 : -1; } else { for (i = r = 0; i < aL; i++) { if (a[i] != b[i]) { r = a[i] > b[i] ? 1 : -1; break; } } } return r; } function subtract(a, b, aL) { var i = 0; // Subtract b from a. for (; aL--;) { a[aL] -= i; i = a[aL] < b[aL] ? 1 : 0; a[aL] = i * BASE + a[aL] - b[aL]; } // Remove leading zeros. for (; !a[0] && a.length > 1;) a.shift(); } return function (x, y, pr, dp) { var cmp, e, i, k, prod, prodL, q, qd, rem, remL, rem0, sd, t, xi, xL, yd0, yL, yz, Ctor = x.constructor, sign = x.s == y.s ? 1 : -1, xd = x.d, yd = y.d; // Either 0? if (!x.s) return new Ctor(x); if (!y.s) throw Error(decimalError + 'Division by zero'); e = x.e - y.e; yL = yd.length; xL = xd.length; q = new Ctor(sign); qd = q.d = []; // Result exponent may be one less than e. for (i = 0; yd[i] == (xd[i] || 0); ) ++i; if (yd[i] > (xd[i] || 0)) --e; if (pr == null) { sd = pr = Ctor.precision; } else if (dp) { sd = pr + (getBase10Exponent(x) - getBase10Exponent(y)) + 1; } else { sd = pr; } if (sd < 0) return new Ctor(0); // Convert precision in number of base 10 digits to base 1e7 digits. sd = sd / LOG_BASE + 2 | 0; i = 0; // divisor < 1e7 if (yL == 1) { k = 0; yd = yd[0]; sd++; // k is the carry. for (; (i < xL || k) && sd--; i++) { t = k * BASE + (xd[i] || 0); qd[i] = t / yd | 0; k = t % yd | 0; } // divisor >= 1e7 } else { // Normalise xd and yd so highest order digit of yd is >= BASE/2 k = BASE / (yd[0] + 1) | 0; if (k > 1) { yd = multiplyInteger(yd, k); xd = multiplyInteger(xd, k); yL = yd.length; xL = xd.length; } xi = yL; rem = xd.slice(0, yL); remL = rem.length; // Add zeros to make remainder as long as divisor. for (; remL < yL;) rem[remL++] = 0; yz = yd.slice(); yz.unshift(0); yd0 = yd[0]; if (yd[1] >= BASE / 2) ++yd0; do { k = 0; // Compare divisor and remainder. cmp = compare(yd, rem, yL, remL); // If divisor < remainder. if (cmp < 0) { // Calculate trial digit, k. rem0 = rem[0]; if (yL != remL) rem0 = rem0 * BASE + (rem[1] || 0); // k will be how many times the divisor goes into the current remainder. k = rem0 / yd0 | 0; // Algorithm: // 1. product = divisor * trial digit (k) // 2. if product > remainder: product -= divisor, k-- // 3. remainder -= product // 4. if product was < remainder at 2: // 5. compare new remainder and divisor // 6. If remainder > divisor: remainder -= divisor, k++ if (k > 1) { if (k >= BASE) k = BASE - 1; // product = divisor * trial digit. prod = multiplyInteger(yd, k); prodL = prod.length; remL = rem.length; // Compare product and remainder. cmp = compare(prod, rem, prodL, remL); // product > remainder. if (cmp == 1) { k--; // Subtract divisor from product. subtract(prod, yL < prodL ? yz : yd, prodL); } } else { // cmp is -1. // If k is 0, there is no need to compare yd and rem again below, so change cmp to 1 // to avoid it. If k is 1 there is a need to compare yd and rem again below. if (k == 0) cmp = k = 1; prod = yd.slice(); } prodL = prod.length; if (prodL < remL) prod.unshift(0); // Subtract product from remainder. subtract(rem, prod, remL); // If product was < previous remainder. if (cmp == -1) { remL = rem.length; // Compare divisor and new remainder. cmp = compare(yd, rem, yL, remL); // If divisor < new remainder, subtract divisor from remainder. if (cmp < 1) { k++; // Subtract divisor from remainder. subtract(rem, yL < remL ? yz : yd, remL); } } remL = rem.length; } else if (cmp === 0) { k++; rem = [0]; } // if cmp === 1, k will be 0 // Add the next digit, k, to the result array. qd[i++] = k; // Update the remainder. if (cmp && rem[0]) { rem[remL++] = xd[xi] || 0; } else { rem = [xd[xi]]; remL = 1; } } while ((xi++ < xL || rem[0] !== void 0) && sd--); } // Leading zero? if (!qd[0]) qd.shift(); q.e = e; return round(q, dp ? pr + getBase10Exponent(q) + 1 : pr); }; })(); /* * Return a new Decimal whose value is the natural exponential of `x` truncated to `sd` * significant digits. * * Taylor/Maclaurin series. * * exp(x) = x^0/0! + x^1/1! + x^2/2! + x^3/3! + ... * * Argument reduction: * Repeat x = x / 32, k += 5, until |x| < 0.1 * exp(x) = exp(x / 2^k)^(2^k) * * Previously, the argument was initially reduced by * exp(x) = exp(r) * 10^k where r = x - k * ln10, k = floor(x / ln10) * to first put r in the range [0, ln10], before dividing by 32 until |x| < 0.1, but this was * found to be slower than just dividing repeatedly by 32 as above. * * (Math object integer min/max: Math.exp(709) = 8.2e+307, Math.exp(-745) = 5e-324) * * exp(x) is non-terminating for any finite, non-zero x. * */ function exp(x, sd) { var denominator, guard, pow, sum, t, wpr, i = 0, k = 0, Ctor = x.constructor, pr = Ctor.precision; if (getBase10Exponent(x) > 16) throw Error(exponentOutOfRange + getBase10Exponent(x)); // exp(0) = 1 if (!x.s) return new Ctor(ONE); if (sd == null) { external = false; wpr = pr; } else { wpr = sd; } t = new Ctor(0.03125); while (x.abs().gte(0.1)) { x = x.times(t); // x = x / 2^5 k += 5; } // Estimate the precision increase necessary to ensure the first 4 rounding digits are correct. guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0; wpr += guard; denominator = pow = sum = new Ctor(ONE); Ctor.precision = wpr; for (;;) { pow = round(pow.times(x), wpr); denominator = denominator.times(++i); t = sum.plus(divide(pow, denominator, wpr)); if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) { while (k--) sum = round(sum.times(sum), wpr); Ctor.precision = pr; return sd == null ? (external = true, round(sum, pr)) : sum; } sum = t; } } // Calculate the base 10 exponent from the base 1e7 exponent. function getBase10Exponent(x) { var e = x.e * LOG_BASE, w = x.d[0]; // Add the number of digits of the first word of the digits array. for (; w >= 10; w /= 10) e++; return e; } function getLn10(Ctor, sd, pr) { if (sd > Ctor.LN10.sd()) { // Reset global state in case the exception is caught. external = true; if (pr) Ctor.precision = pr; throw Error(decimalError + 'LN10 precision limit exceeded'); } return round(new Ctor(Ctor.LN10), sd); } function getZeroString(k) { var zs = ''; for (; k--;) zs += '0'; return zs; } /* * Return a new Decimal whose value is the natural logarithm of `x` truncated to `sd` significant * digits. * * ln(n) is non-terminating (n != 1) * */ function ln(y, sd) { var c, c0, denominator, e, numerator, sum, t, wpr, x2, n = 1, guard = 10, x = y, xd = x.d, Ctor = x.constructor, pr = Ctor.precision; // ln(-x) = NaN // ln(0) = -Infinity if (x.s < 1) throw Error(decimalError + (x.s ? 'NaN' : '-Infinity')); // ln(1) = 0 if (x.eq(ONE)) return new Ctor(0); if (sd == null) { external = false; wpr = pr; } else { wpr = sd; } if (x.eq(10)) { if (sd == null) external = true; return getLn10(Ctor, wpr); } wpr += guard; Ctor.precision = wpr; c = digitsToString(xd); c0 = c.charAt(0); e = getBase10Exponent(x); if (Math.abs(e) < 1.5e15) { // Argument reduction. // The series converges faster the closer the argument is to 1, so using // ln(a^b) = b * ln(a), ln(a) = ln(a^b) / b // multiply the argument by itself until the leading digits of the significand are 7, 8, 9, // 10, 11, 12 or 13, recording the number of multiplications so the sum of the series can // later be divided by this number, then separate out the power of 10 using // ln(a*10^b) = ln(a) + b*ln(10). // max n is 21 (gives 0.9, 1.0 or 1.1) (9e15 / 21 = 4.2e14). //while (c0 < 9 && c0 != 1 || c0 == 1 && c.charAt(1) > 1) { // max n is 6 (gives 0.7 - 1.3) while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) { x = x.times(y); c = digitsToString(x.d); c0 = c.charAt(0); n++; } e = getBase10Exponent(x); if (c0 > 1) { x = new Ctor('0.' + c); e++; } else { x = new Ctor(c0 + '.' + c.slice(1)); } } else { // The argument reduction method above may result in overflow if the argument y is a massive // number with exponent >= 1500000000000000 (9e15 / 6 = 1.5e15), so instead recall this // function using ln(x*10^e) = ln(x) + e*ln(10). t = getLn10(Ctor, wpr + 2, pr).times(e + ''); x = ln(new Ctor(c0 + '.' + c.slice(1)), wpr - guard).plus(t); Ctor.precision = pr; return sd == null ? (external = true, round(x, pr)) : x; } // x is reduced to a value near 1. // Taylor series. // ln(y) = ln((1 + x)/(1 - x)) = 2(x + x^3/3 + x^5/5 + x^7/7 + ...) // where x = (y - 1)/(y + 1) (|x| < 1) sum = numerator = x = divide(x.minus(ONE), x.plus(ONE), wpr); x2 = round(x.times(x), wpr); denominator = 3; for (;;) { numerator = round(numerator.times(x2), wpr); t = sum.plus(divide(numerator, new Ctor(denominator), wpr)); if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) { sum = sum.times(2); // Reverse the argument reduction. if (e !== 0) sum = sum.plus(getLn10(Ctor, wpr + 2, pr).times(e + '')); sum = divide(sum, new Ctor(n), wpr); Ctor.precision = pr; return sd == null ? (external = true, round(sum, pr)) : sum; } sum = t; denominator += 2; } } /* * Parse the value of a new Decimal `x` from string `str`. */ function parseDecimal(x, str) { var e, i, len; // Decimal point? if ((e = str.indexOf('.')) > -1) str = str.replace('.', ''); // Exponential form? if ((i = str.search(/e/i)) > 0) { // Determine exponent. if (e < 0) e = i; e += +str.slice(i + 1); str = str.substring(0, i); } else if (e < 0) { // Integer. e = str.length; } // Determine leading zeros. for (i = 0; str.charCodeAt(i) === 48;) ++i; // Determine trailing zeros. for (len = str.length; str.charCodeAt(len - 1) === 48;) --len; str = str.slice(i, len); if (str) { len -= i; e = e - i - 1; x.e = mathfloor(e / LOG_BASE); x.d = []; // Transform base // e is the base 10 exponent. // i is where to slice str to get the first word of the digits array. i = (e + 1) % LOG_BASE; if (e < 0) i += LOG_BASE; if (i < len) { if (i) x.d.push(+str.slice(0, i)); for (len -= LOG_BASE; i < len;) x.d.push(+str.slice(i, i += LOG_BASE)); str = str.slice(i); i = LOG_BASE - str.length; } else { i -= len; } for (; i--;) str += '0'; x.d.push(+str); if (external && (x.e > MAX_E || x.e < -MAX_E)) throw Error(exponentOutOfRange + e); } else { // Zero. x.s = 0; x.e = 0; x.d = [0]; } return x; } /* * Round `x` to `sd` significant digits, using rounding mode `rm` if present (truncate otherwise). */ function round(x, sd, rm) { var i, j, k, n, rd, doRound, w, xdi, xd = x.d; // rd: the rounding digit, i.e. the digit after the digit that may be rounded up. // w: the word of xd which contains the rounding digit, a base 1e7 number. // xdi: the index of w within xd. // n: the number of digits of w. // i: what would be the index of rd within w if all the numbers were 7 digits long (i.e. if // they had leading zeros) // j: if > 0, the actual index of rd within w (if < 0, rd is a leading zero). // Get the length of the first word of the digits array xd. for (n = 1, k = xd[0]; k >= 10; k /= 10) n++; i = sd - n; // Is the rounding digit in the first word of xd? if (i < 0) { i += LOG_BASE; j = sd; w = xd[xdi = 0]; } else { xdi = Math.ceil((i + 1) / LOG_BASE); k = xd.length; if (xdi >= k) return x; w = k = xd[xdi]; // Get the number of digits of w. for (n = 1; k >= 10; k /= 10) n++; // Get the index of rd within w. i %= LOG_BASE; // Get the index of rd within w, adjusted for leading zeros. // The number of leading zeros of w is given by LOG_BASE - n. j = i - LOG_BASE + n; } if (rm !== void 0) { k = mathpow(10, n - j - 1); // Get the rounding digit at index j of w. rd = w / k % 10 | 0; // Are there any non-zero digits after the rounding digit? doRound = sd < 0 || xd[xdi + 1] !== void 0 || w % k; // The expression `w % mathpow(10, n - j - 1)` returns all the digits of w to the right of the // digit at (left-to-right) index j, e.g. if w is 908714 and j is 2, the expression will give // 714. doRound = rm < 4 ? (rd || doRound) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || doRound || rm == 6 && // Check whether the digit to the left of the rounding digit is odd. ((i > 0 ? j > 0 ? w / mathpow(10, n - j) : 0 : xd[xdi - 1]) % 10) & 1 || rm == (x.s < 0 ? 8 : 7)); } if (sd < 1 || !xd[0]) { if (doRound) { k = getBase10Exponent(x); xd.length = 1; // Convert sd to decimal places. sd = sd - k - 1; // 1, 0.1, 0.01, 0.001, 0.0001 etc. xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE); x.e = mathfloor(-sd / LOG_BASE) || 0; } else { xd.length = 1; // Zero. xd[0] = x.e = x.s = 0; } return x; } // Remove excess digits. if (i == 0) { xd.length = xdi; k = 1; xdi--; } else { xd.length = xdi + 1; k = mathpow(10, LOG_BASE - i); // E.g. 56700 becomes 56000 if 7 is the rounding digit. // j > 0 means i > number of leading zeros of w. xd[xdi] = j > 0 ? (w / mathpow(10, n - j) % mathpow(10, j) | 0) * k : 0; } if (doRound) { for (;;) { // Is the digit to be rounded up in the first word of xd? if (xdi == 0) { if ((xd[0] += k) == BASE) { xd[0] = 1; ++x.e; } break; } else { xd[xdi] += k; if (xd[xdi] != BASE) break; xd[xdi--] = 0; k = 1; } } } // Remove trailing zeros. for (i = xd.length; xd[--i] === 0;) xd.pop(); if (external && (x.e > MAX_E || x.e < -MAX_E)) { throw Error(exponentOutOfRange + getBase10Exponent(x)); } return x; } function subtract(x, y) { var d, e, i, j, k, len, xd, xe, xLTy, yd, Ctor = x.constructor, pr = Ctor.precision; // Return y negated if x is zero. // Return x if y is zero and x is non-zero. if (!x.s || !y.s) { if (y.s) y.s = -y.s; else y = new Ctor(x); return external ? round(y, pr) : y; } xd = x.d; yd = y.d; // x and y are non-zero numbers with the same sign. e = y.e; xe = x.e; xd = xd.slice(); k = xe - e; // If exponents differ... if (k) { xLTy = k < 0; if (xLTy) { d = xd; k = -k; len = yd.length; } else { d = yd; e = xe; len = xd.length; } // Numbers with massively different exponents would result in a very high number of zeros // needing to be prepended, but this can be avoided while still ensuring correct rounding by // limiting the number of zeros to `Math.ceil(pr / LOG_BASE) + 2`. i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2; if (k > i) { k = i; d.length = 1; } // Prepend zeros to equalise exponents. d.reverse(); for (i = k; i--;) d.push(0); d.reverse(); // Base 1e7 exponents equal. } else { // Check digits to determine which is the bigger number. i = xd.length; len = yd.length; xLTy = i < len; if (xLTy) len = i; for (i = 0; i < len; i++) { if (xd[i] != yd[i]) { xLTy = xd[i] < yd[i]; break; } } k = 0; } if (xLTy) { d = xd; xd = yd; yd = d; y.s = -y.s; } len = xd.length; // Append zeros to xd if shorter. // Don't add zeros to yd if shorter as subtraction only needs to start at yd length. for (i = yd.length - len; i > 0; --i) xd[len++] = 0; // Subtract yd from xd. for (i = yd.length; i > k;) { if (xd[--i] < yd[i]) { for (j = i; j && xd[--j] === 0;) xd[j] = BASE - 1; --xd[j]; xd[i] += BASE; } xd[i] -= yd[i]; } // Remove trailing zeros. for (; xd[--len] === 0;) xd.pop(); // Remove leading zeros and adjust exponent accordingly. for (; xd[0] === 0; xd.shift()) --e; // Zero? if (!xd[0]) return new Ctor(0); y.d = xd; y.e = e; //return external && xd.length >= pr / LOG_BASE ? round(y, pr) : y; return external ? round(y, pr) : y; } function toString(x, isExp, sd) { var k, e = getBase10Exponent(x), str = digitsToString(x.d), len = str.length; if (isExp) { if (sd && (k = sd - len) > 0) { str = str.charAt(0) + '.' + str.slice(1) + getZeroString(k); } else if (len > 1) { str = str.charAt(0) + '.' + str.slice(1); } str = str + (e < 0 ? 'e' : 'e+') + e; } else if (e < 0) { str = '0.' + getZeroString(-e - 1) + str; if (sd && (k = sd - len) > 0) str += getZeroString(k); } else if (e >= len) { str += getZeroString(e + 1 - len); if (sd && (k = sd - e - 1) > 0) str = str + '.' + getZeroString(k); } else { if ((k = e + 1) < len) str = str.slice(0, k) + '.' + str.slice(k); if (sd && (k = sd - len) > 0) { if (e + 1 === len) str += '.'; str += getZeroString(k); } } return x.s < 0 ? '-' + str : str; } // Does not strip trailing zeros. function truncate(arr, len) { if (arr.length > len) { arr.length = len; return true; } } // Decimal methods /* * clone * config/set */ /* * Create and return a Decimal constructor with the same configuration properties as this Decimal * constructor. * */ function clone(obj) { var i, p, ps; /* * The Decimal constructor and exported function. * Return a new Decimal instance. * * value {number|string|Decimal} A numeric value. * */ function Decimal(value) { var x = this; // Decimal called without new. if (!(x instanceof Decimal)) return new Decimal(value); // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor // which points to Object. x.constructor = Decimal; // Duplicate. if (value instanceof Decimal) { x.s = value.s; x.e = value.e; x.d = (value = value.d) ? value.slice() : value; return; } if (typeof value === 'number') { // Reject Infinity/NaN. if (value * 0 !== 0) { throw Error(invalidArgument + value); } if (value > 0) { x.s = 1; } else if (value < 0) { value = -value; x.s = -1; } else { x.s = 0; x.e = 0; x.d = [0]; return; } // Fast path for small integers. if (value === ~~value && value < 1e7) { x.e = 0; x.d = [value]; return; } return parseDecimal(x, value.toString()); } else if (typeof value !== 'string') { throw Error(invalidArgument + value); } // Minus sign? if (value.charCodeAt(0) === 45) { value = value.slice(1); x.s = -1; } else { x.s = 1; } if (isDecimal.test(value)) parseDecimal(x, value); else throw Error(invalidArgument + value); } Decimal.prototype = P; Decimal.ROUND_UP = 0; Decimal.ROUND_DOWN = 1; Decimal.ROUND_CEIL = 2; Decimal.ROUND_FLOOR = 3; Decimal.ROUND_HALF_UP = 4; Decimal.ROUND_HALF_DOWN = 5; Decimal.ROUND_HALF_EVEN = 6; Decimal.ROUND_HALF_CEIL = 7; Decimal.ROUND_HALF_FLOOR = 8; Decimal.clone = clone; Decimal.config = Decimal.set = config; if (obj === void 0) obj = {}; if (obj) { ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'LN10']; for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p]; } Decimal.config(obj); return Decimal; } /* * Configure global settings for a Decimal constructor. * * `obj` is an object with one or more of the following properties, * * precision {number} * rounding {number} * toExpNeg {number} * toExpPos {number} * * E.g. Decimal.config({ precision: 20, rounding: 4 }) * */ function config(obj) { if (!obj || typeof obj !== 'object') { throw Error(decimalError + 'Object expected'); } var i, p, v, ps = [ 'precision', 1, MAX_DIGITS, 'rounding', 0, 8, 'toExpNeg', -1 / 0, 0, 'toExpPos', 0, 1 / 0 ]; for (i = 0; i < ps.length; i += 3) { if ((v = obj[p = ps[i]]) !== void 0) { if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v; else throw Error(invalidArgument + p + ': ' + v); } } if ((v = obj[p = 'LN10']) !== void 0) { if (v == Math.LN10) this[p] = new this(v); else throw Error(invalidArgument + p + ': ' + v); } return this; } // Create and configure initial Decimal constructor. Decimal = clone(Decimal); Decimal['default'] = Decimal.Decimal = Decimal; // Internal constant. ONE = new Decimal(1); // Export. // AMD. if (true) { !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () { return Decimal; }).call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); // Node and other environments that support module.exports. } else {} })(this); /***/ }), /***/ 60374: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { "BaseContract": function() { return /* reexport */ lib_esm.BaseContract; }, "BigNumber": function() { return /* reexport */ bignumber/* BigNumber */.O$; }, "Contract": function() { return /* reexport */ lib_esm.Contract; }, "ContractFactory": function() { return /* reexport */ lib_esm.ContractFactory; }, "FixedNumber": function() { return /* reexport */ fixednumber/* FixedNumber */.xs; }, "Signer": function() { return /* reexport */ abstract_signer_lib_esm.Signer; }, "VoidSigner": function() { return /* reexport */ abstract_signer_lib_esm.VoidSigner; }, "Wallet": function() { return /* reexport */ wallet_lib_esm.Wallet; }, "Wordlist": function() { return /* reexport */ wordlist/* Wordlist */.D; }, "constants": function() { return /* reexport */ constants_lib_esm; }, "errors": function() { return /* reexport */ logger_lib_esm.ErrorCode; }, "ethers": function() { return /* reexport */ ethers_namespaceObject; }, "getDefaultProvider": function() { return /* reexport */ providers_lib_esm.getDefaultProvider; }, "logger": function() { return /* reexport */ logger; }, "providers": function() { return /* reexport */ providers_lib_esm; }, "utils": function() { return /* reexport */ utils_namespaceObject; }, "version": function() { return /* reexport */ version; }, "wordlists": function() { return /* reexport */ wordlists/* wordlists */.E; } }); // NAMESPACE OBJECT: ./node_modules/ethers/lib.esm/utils.js var utils_namespaceObject = {}; __webpack_require__.r(utils_namespaceObject); __webpack_require__.d(utils_namespaceObject, { "AbiCoder": function() { return abi_coder/* AbiCoder */.R; }, "ConstructorFragment": function() { return fragments/* ConstructorFragment */.Xg; }, "ErrorFragment": function() { return fragments/* ErrorFragment */.IC; }, "EventFragment": function() { return fragments/* EventFragment */.QV; }, "FormatTypes": function() { return fragments/* FormatTypes */.pc; }, "Fragment": function() { return fragments/* Fragment */.HY; }, "FunctionFragment": function() { return fragments/* FunctionFragment */.YW; }, "HDNode": function() { return hdnode_lib_esm.HDNode; }, "Indexed": function() { return lib_esm_interface/* Indexed */.Hk; }, "Interface": function() { return lib_esm_interface/* Interface */.vU; }, "LogDescription": function() { return lib_esm_interface/* LogDescription */.CC; }, "Logger": function() { return logger_lib_esm.Logger; }, "ParamType": function() { return fragments/* ParamType */._R; }, "RLP": function() { return rlp_lib_esm; }, "SigningKey": function() { return signing_key_lib_esm.SigningKey; }, "SupportedAlgorithm": function() { return types/* SupportedAlgorithm */.p; }, "TransactionDescription": function() { return lib_esm_interface/* TransactionDescription */.vk; }, "TransactionTypes": function() { return transactions_lib_esm.TransactionTypes; }, "UnicodeNormalizationForm": function() { return utf8/* UnicodeNormalizationForm */.Uj; }, "Utf8ErrorFuncs": function() { return utf8/* Utf8ErrorFuncs */.te; }, "Utf8ErrorReason": function() { return utf8/* Utf8ErrorReason */.Uw; }, "_TypedDataEncoder": function() { return typed_data/* TypedDataEncoder */.E; }, "_fetchData": function() { return web_lib_esm._fetchData; }, "_toEscapedUtf8String": function() { return utf8/* _toEscapedUtf8String */.U$; }, "accessListify": function() { return transactions_lib_esm.accessListify; }, "arrayify": function() { return bytes_lib_esm.arrayify; }, "base58": function() { return basex_lib_esm.Base58; }, "base64": function() { return base64_lib_esm; }, "checkProperties": function() { return properties_lib_esm.checkProperties; }, "checkResultErrors": function() { return abstract_coder/* checkResultErrors */.BR; }, "commify": function() { return units_lib_esm.commify; }, "computeAddress": function() { return transactions_lib_esm.computeAddress; }, "computeHmac": function() { return sha2/* computeHmac */.Gy; }, "computePublicKey": function() { return signing_key_lib_esm.computePublicKey; }, "concat": function() { return bytes_lib_esm.concat; }, "deepCopy": function() { return properties_lib_esm.deepCopy; }, "defaultAbiCoder": function() { return abi_coder/* defaultAbiCoder */.$; }, "defaultPath": function() { return hdnode_lib_esm.defaultPath; }, "defineReadOnly": function() { return properties_lib_esm.defineReadOnly; }, "dnsEncode": function() { return namehash/* dnsEncode */.Kn; }, "entropyToMnemonic": function() { return hdnode_lib_esm.entropyToMnemonic; }, "fetchJson": function() { return web_lib_esm.fetchJson; }, "formatBytes32String": function() { return bytes32/* formatBytes32String */.s; }, "formatEther": function() { return units_lib_esm.formatEther; }, "formatUnits": function() { return units_lib_esm.formatUnits; }, "getAccountPath": function() { return hdnode_lib_esm.getAccountPath; }, "getAddress": function() { return address_lib_esm.getAddress; }, "getContractAddress": function() { return address_lib_esm.getContractAddress; }, "getCreate2Address": function() { return address_lib_esm.getCreate2Address; }, "getIcapAddress": function() { return address_lib_esm.getIcapAddress; }, "getJsonWalletAddress": function() { return inspect/* getJsonWalletAddress */.Rb; }, "getStatic": function() { return properties_lib_esm.getStatic; }, "hashMessage": function() { return message/* hashMessage */.r; }, "hexConcat": function() { return bytes_lib_esm.hexConcat; }, "hexDataLength": function() { return bytes_lib_esm.hexDataLength; }, "hexDataSlice": function() { return bytes_lib_esm.hexDataSlice; }, "hexStripZeros": function() { return bytes_lib_esm.hexStripZeros; }, "hexValue": function() { return bytes_lib_esm.hexValue; }, "hexZeroPad": function() { return bytes_lib_esm.hexZeroPad; }, "hexlify": function() { return bytes_lib_esm.hexlify; }, "id": function() { return id.id; }, "isAddress": function() { return address_lib_esm.isAddress; }, "isBytes": function() { return bytes_lib_esm.isBytes; }, "isBytesLike": function() { return bytes_lib_esm.isBytesLike; }, "isHexString": function() { return bytes_lib_esm.isHexString; }, "isValidMnemonic": function() { return hdnode_lib_esm.isValidMnemonic; }, "isValidName": function() { return namehash/* isValidName */.r1; }, "joinSignature": function() { return bytes_lib_esm.joinSignature; }, "keccak256": function() { return keccak256_lib_esm.keccak256; }, "mnemonicToEntropy": function() { return hdnode_lib_esm.mnemonicToEntropy; }, "mnemonicToSeed": function() { return hdnode_lib_esm.mnemonicToSeed; }, "namehash": function() { return namehash/* namehash */.VM; }, "nameprep": function() { return idna/* nameprep */.Ll; }, "parseBytes32String": function() { return bytes32/* parseBytes32String */.F; }, "parseEther": function() { return units_lib_esm.parseEther; }, "parseTransaction": function() { return transactions_lib_esm.parse; }, "parseUnits": function() { return units_lib_esm.parseUnits; }, "poll": function() { return web_lib_esm.poll; }, "randomBytes": function() { return random/* randomBytes */.O; }, "recoverAddress": function() { return transactions_lib_esm.recoverAddress; }, "recoverPublicKey": function() { return signing_key_lib_esm.recoverPublicKey; }, "resolveProperties": function() { return properties_lib_esm.resolveProperties; }, "ripemd160": function() { return sha2/* ripemd160 */.bP; }, "serializeTransaction": function() { return transactions_lib_esm.serialize; }, "sha256": function() { return sha2/* sha256 */.JQ; }, "sha512": function() { return sha2/* sha512 */.o; }, "shallowCopy": function() { return properties_lib_esm.shallowCopy; }, "shuffled": function() { return shuffle/* shuffled */.y; }, "solidityKeccak256": function() { return solidity_lib_esm.keccak256; }, "solidityPack": function() { return solidity_lib_esm.pack; }, "soliditySha256": function() { return solidity_lib_esm.sha256; }, "splitSignature": function() { return bytes_lib_esm.splitSignature; }, "stripZeros": function() { return bytes_lib_esm.stripZeros; }, "toUtf8Bytes": function() { return utf8/* toUtf8Bytes */.Y0; }, "toUtf8CodePoints": function() { return utf8/* toUtf8CodePoints */.XL; }, "toUtf8String": function() { return utf8/* toUtf8String */.ZN; }, "verifyMessage": function() { return wallet_lib_esm.verifyMessage; }, "verifyTypedData": function() { return wallet_lib_esm.verifyTypedData; }, "zeroPad": function() { return bytes_lib_esm.zeroPad; } }); // NAMESPACE OBJECT: ./node_modules/ethers/lib.esm/ethers.js var ethers_namespaceObject = {}; __webpack_require__.r(ethers_namespaceObject); __webpack_require__.d(ethers_namespaceObject, { "BaseContract": function() { return lib_esm.BaseContract; }, "BigNumber": function() { return bignumber/* BigNumber */.O$; }, "Contract": function() { return lib_esm.Contract; }, "ContractFactory": function() { return lib_esm.ContractFactory; }, "FixedNumber": function() { return fixednumber/* FixedNumber */.xs; }, "Signer": function() { return abstract_signer_lib_esm.Signer; }, "VoidSigner": function() { return abstract_signer_lib_esm.VoidSigner; }, "Wallet": function() { return wallet_lib_esm.Wallet; }, "Wordlist": function() { return wordlist/* Wordlist */.D; }, "constants": function() { return constants_lib_esm; }, "errors": function() { return logger_lib_esm.ErrorCode; }, "getDefaultProvider": function() { return providers_lib_esm.getDefaultProvider; }, "logger": function() { return logger; }, "providers": function() { return providers_lib_esm; }, "utils": function() { return utils_namespaceObject; }, "version": function() { return version; }, "wordlists": function() { return wordlists/* wordlists */.E; } }); // EXTERNAL MODULE: ./node_modules/@ethersproject/contracts/lib.esm/index.js + 1 modules var lib_esm = __webpack_require__(64146); // EXTERNAL MODULE: ./node_modules/@ethersproject/bignumber/lib.esm/bignumber.js var bignumber = __webpack_require__(2593); // EXTERNAL MODULE: ./node_modules/@ethersproject/bignumber/lib.esm/fixednumber.js var fixednumber = __webpack_require__(20335); // EXTERNAL MODULE: ./node_modules/@ethersproject/abstract-signer/lib.esm/index.js + 1 modules var abstract_signer_lib_esm = __webpack_require__(48088); // EXTERNAL MODULE: ./node_modules/@ethersproject/wallet/lib.esm/index.js + 1 modules var wallet_lib_esm = __webpack_require__(79911); // EXTERNAL MODULE: ./node_modules/@ethersproject/constants/lib.esm/index.js + 1 modules var constants_lib_esm = __webpack_require__(21815); // EXTERNAL MODULE: ./node_modules/@ethersproject/providers/lib.esm/index.js + 9 modules var providers_lib_esm = __webpack_require__(88901); // EXTERNAL MODULE: ./node_modules/@ethersproject/wordlists/lib.esm/wordlists.js + 1 modules var wordlists = __webpack_require__(10234); // EXTERNAL MODULE: ./node_modules/@ethersproject/wordlists/lib.esm/wordlist.js + 1 modules var wordlist = __webpack_require__(48812); // EXTERNAL MODULE: ./node_modules/@ethersproject/abi/lib.esm/abi-coder.js + 10 modules var abi_coder = __webpack_require__(84243); // EXTERNAL MODULE: ./node_modules/@ethersproject/abi/lib.esm/fragments.js var fragments = __webpack_require__(11388); // EXTERNAL MODULE: ./node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js var abstract_coder = __webpack_require__(61184); // EXTERNAL MODULE: ./node_modules/@ethersproject/abi/lib.esm/interface.js var lib_esm_interface = __webpack_require__(8198); // EXTERNAL MODULE: ./node_modules/@ethersproject/address/lib.esm/index.js + 1 modules var address_lib_esm = __webpack_require__(19485); // EXTERNAL MODULE: ./node_modules/@ethersproject/base64/lib.esm/index.js var base64_lib_esm = __webpack_require__(4089); // EXTERNAL MODULE: ./node_modules/@ethersproject/basex/lib.esm/index.js var basex_lib_esm = __webpack_require__(57727); // EXTERNAL MODULE: ./node_modules/@ethersproject/bytes/lib.esm/index.js + 1 modules var bytes_lib_esm = __webpack_require__(16441); // EXTERNAL MODULE: ./node_modules/@ethersproject/hash/lib.esm/namehash.js var namehash = __webpack_require__(84706); // EXTERNAL MODULE: ./node_modules/@ethersproject/hash/lib.esm/message.js var message = __webpack_require__(93684); // EXTERNAL MODULE: ./node_modules/@ethersproject/hash/lib.esm/id.js var id = __webpack_require__(32046); // EXTERNAL MODULE: ./node_modules/@ethersproject/hash/lib.esm/typed-data.js var typed_data = __webpack_require__(67827); // EXTERNAL MODULE: ./node_modules/@ethersproject/hdnode/lib.esm/index.js + 1 modules var hdnode_lib_esm = __webpack_require__(84178); // EXTERNAL MODULE: ./node_modules/@ethersproject/json-wallets/lib.esm/inspect.js var inspect = __webpack_require__(67949); // EXTERNAL MODULE: ./node_modules/@ethersproject/keccak256/lib.esm/index.js var keccak256_lib_esm = __webpack_require__(38197); // EXTERNAL MODULE: ./node_modules/@ethersproject/logger/lib.esm/index.js + 1 modules var logger_lib_esm = __webpack_require__(1581); // EXTERNAL MODULE: ./node_modules/@ethersproject/sha2/lib.esm/sha2.js + 1 modules var sha2 = __webpack_require__(2006); // EXTERNAL MODULE: ./node_modules/@ethersproject/solidity/lib.esm/index.js + 1 modules var solidity_lib_esm = __webpack_require__(31886); // EXTERNAL MODULE: ./node_modules/@ethersproject/random/lib.esm/random.js + 1 modules var random = __webpack_require__(5634); // EXTERNAL MODULE: ./node_modules/@ethersproject/random/lib.esm/shuffle.js var shuffle = __webpack_require__(52472); // EXTERNAL MODULE: ./node_modules/@ethersproject/properties/lib.esm/index.js + 1 modules var properties_lib_esm = __webpack_require__(6881); // EXTERNAL MODULE: ./node_modules/@ethersproject/rlp/lib.esm/index.js + 1 modules var rlp_lib_esm = __webpack_require__(59052); // EXTERNAL MODULE: ./node_modules/@ethersproject/signing-key/lib.esm/index.js + 2 modules var signing_key_lib_esm = __webpack_require__(67669); // EXTERNAL MODULE: ./node_modules/@ethersproject/strings/lib.esm/idna.js var idna = __webpack_require__(35637); // EXTERNAL MODULE: ./node_modules/@ethersproject/strings/lib.esm/utf8.js + 1 modules var utf8 = __webpack_require__(29251); // EXTERNAL MODULE: ./node_modules/@ethersproject/strings/lib.esm/bytes32.js var bytes32 = __webpack_require__(86237); // EXTERNAL MODULE: ./node_modules/@ethersproject/transactions/lib.esm/index.js + 1 modules var transactions_lib_esm = __webpack_require__(83875); // EXTERNAL MODULE: ./node_modules/@ethersproject/units/lib.esm/index.js + 1 modules var units_lib_esm = __webpack_require__(61744); // EXTERNAL MODULE: ./node_modules/@ethersproject/web/lib.esm/index.js + 2 modules var web_lib_esm = __webpack_require__(37707); // EXTERNAL MODULE: ./node_modules/@ethersproject/sha2/lib.esm/types.js var types = __webpack_require__(21261); ;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/utils.js //////////////////////// // Enums //////////////////////// // Exports //# sourceMappingURL=utils.js.map ;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/_version.js const version = "ethers/5.6.9"; //# sourceMappingURL=_version.js.map ;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/ethers.js //////////////////////// // Compile-Time Constants // This is generated by "npm run dist" const logger = new logger_lib_esm.Logger(version); //////////////////////// // Exports //# sourceMappingURL=ethers.js.map ;// CONCATENATED MODULE: ./node_modules/ethers/lib.esm/index.js // To modify this file, you must update ./misc/admin/lib/cmds/update-exports.js try { const anyGlobal = window; if (anyGlobal._ethers == null) { anyGlobal._ethers = ethers_namespaceObject; } } catch (error) { } //# sourceMappingURL=index.js.map /***/ }), /***/ 39647: /***/ (function(__unused_webpack_module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.version = void 0; exports.version = "ethers/5.6.9"; //# sourceMappingURL=_version.js.map /***/ }), /***/ 5151: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Wordlist = exports.version = exports.wordlists = exports.utils = exports.logger = exports.errors = exports.constants = exports.FixedNumber = exports.BigNumber = exports.ContractFactory = exports.Contract = exports.BaseContract = exports.providers = exports.getDefaultProvider = exports.VoidSigner = exports.Wallet = exports.Signer = void 0; var contracts_1 = __webpack_require__(64146); Object.defineProperty(exports, "BaseContract", ({ enumerable: true, get: function () { return contracts_1.BaseContract; } })); Object.defineProperty(exports, "Contract", ({ enumerable: true, get: function () { return contracts_1.Contract; } })); Object.defineProperty(exports, "ContractFactory", ({ enumerable: true, get: function () { return contracts_1.ContractFactory; } })); var bignumber_1 = __webpack_require__(833); Object.defineProperty(exports, "BigNumber", ({ enumerable: true, get: function () { return bignumber_1.BigNumber; } })); Object.defineProperty(exports, "FixedNumber", ({ enumerable: true, get: function () { return bignumber_1.FixedNumber; } })); var abstract_signer_1 = __webpack_require__(48088); Object.defineProperty(exports, "Signer", ({ enumerable: true, get: function () { return abstract_signer_1.Signer; } })); Object.defineProperty(exports, "VoidSigner", ({ enumerable: true, get: function () { return abstract_signer_1.VoidSigner; } })); var wallet_1 = __webpack_require__(79911); Object.defineProperty(exports, "Wallet", ({ enumerable: true, get: function () { return wallet_1.Wallet; } })); var constants = __importStar(__webpack_require__(21815)); exports.constants = constants; var providers = __importStar(__webpack_require__(88901)); exports.providers = providers; var providers_1 = __webpack_require__(88901); Object.defineProperty(exports, "getDefaultProvider", ({ enumerable: true, get: function () { return providers_1.getDefaultProvider; } })); var wordlists_1 = __webpack_require__(78435); Object.defineProperty(exports, "Wordlist", ({ enumerable: true, get: function () { return wordlists_1.Wordlist; } })); Object.defineProperty(exports, "wordlists", ({ enumerable: true, get: function () { return wordlists_1.wordlists; } })); var utils = __importStar(__webpack_require__(56371)); exports.utils = utils; var logger_1 = __webpack_require__(1581); Object.defineProperty(exports, "errors", ({ enumerable: true, get: function () { return logger_1.ErrorCode; } })); //////////////////////// // Compile-Time Constants // This is generated by "npm run dist" var _version_1 = __webpack_require__(39647); Object.defineProperty(exports, "version", ({ enumerable: true, get: function () { return _version_1.version; } })); var logger = new logger_1.Logger(_version_1.version); exports.logger = logger; //# sourceMappingURL=ethers.js.map /***/ }), /***/ 56371: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.formatBytes32String = exports.Utf8ErrorFuncs = exports.toUtf8String = exports.toUtf8CodePoints = exports.toUtf8Bytes = exports._toEscapedUtf8String = exports.nameprep = exports.hexDataSlice = exports.hexDataLength = exports.hexZeroPad = exports.hexValue = exports.hexStripZeros = exports.hexConcat = exports.isHexString = exports.hexlify = exports.base64 = exports.base58 = exports.TransactionDescription = exports.LogDescription = exports.Interface = exports.SigningKey = exports.HDNode = exports.defaultPath = exports.isBytesLike = exports.isBytes = exports.zeroPad = exports.stripZeros = exports.concat = exports.arrayify = exports.shallowCopy = exports.resolveProperties = exports.getStatic = exports.defineReadOnly = exports.deepCopy = exports.checkProperties = exports.poll = exports.fetchJson = exports._fetchData = exports.RLP = exports.Logger = exports.checkResultErrors = exports.FormatTypes = exports.ParamType = exports.FunctionFragment = exports.EventFragment = exports.ErrorFragment = exports.ConstructorFragment = exports.Fragment = exports.defaultAbiCoder = exports.AbiCoder = void 0; exports.Indexed = exports.Utf8ErrorReason = exports.UnicodeNormalizationForm = exports.SupportedAlgorithm = exports.mnemonicToSeed = exports.isValidMnemonic = exports.entropyToMnemonic = exports.mnemonicToEntropy = exports.getAccountPath = exports.verifyTypedData = exports.verifyMessage = exports.recoverPublicKey = exports.computePublicKey = exports.recoverAddress = exports.computeAddress = exports.getJsonWalletAddress = exports.TransactionTypes = exports.serializeTransaction = exports.parseTransaction = exports.accessListify = exports.joinSignature = exports.splitSignature = exports.soliditySha256 = exports.solidityKeccak256 = exports.solidityPack = exports.shuffled = exports.randomBytes = exports.sha512 = exports.sha256 = exports.ripemd160 = exports.keccak256 = exports.computeHmac = exports.commify = exports.parseUnits = exports.formatUnits = exports.parseEther = exports.formatEther = exports.isAddress = exports.getCreate2Address = exports.getContractAddress = exports.getIcapAddress = exports.getAddress = exports._TypedDataEncoder = exports.id = exports.isValidName = exports.namehash = exports.hashMessage = exports.dnsEncode = exports.parseBytes32String = void 0; var abi_1 = __webpack_require__(83893); Object.defineProperty(exports, "AbiCoder", ({ enumerable: true, get: function () { return abi_1.AbiCoder; } })); Object.defineProperty(exports, "checkResultErrors", ({ enumerable: true, get: function () { return abi_1.checkResultErrors; } })); Object.defineProperty(exports, "ConstructorFragment", ({ enumerable: true, get: function () { return abi_1.ConstructorFragment; } })); Object.defineProperty(exports, "defaultAbiCoder", ({ enumerable: true, get: function () { return abi_1.defaultAbiCoder; } })); Object.defineProperty(exports, "ErrorFragment", ({ enumerable: true, get: function () { return abi_1.ErrorFragment; } })); Object.defineProperty(exports, "EventFragment", ({ enumerable: true, get: function () { return abi_1.EventFragment; } })); Object.defineProperty(exports, "FormatTypes", ({ enumerable: true, get: function () { return abi_1.FormatTypes; } })); Object.defineProperty(exports, "Fragment", ({ enumerable: true, get: function () { return abi_1.Fragment; } })); Object.defineProperty(exports, "FunctionFragment", ({ enumerable: true, get: function () { return abi_1.FunctionFragment; } })); Object.defineProperty(exports, "Indexed", ({ enumerable: true, get: function () { return abi_1.Indexed; } })); Object.defineProperty(exports, "Interface", ({ enumerable: true, get: function () { return abi_1.Interface; } })); Object.defineProperty(exports, "LogDescription", ({ enumerable: true, get: function () { return abi_1.LogDescription; } })); Object.defineProperty(exports, "ParamType", ({ enumerable: true, get: function () { return abi_1.ParamType; } })); Object.defineProperty(exports, "TransactionDescription", ({ enumerable: true, get: function () { return abi_1.TransactionDescription; } })); var address_1 = __webpack_require__(19485); Object.defineProperty(exports, "getAddress", ({ enumerable: true, get: function () { return address_1.getAddress; } })); Object.defineProperty(exports, "getCreate2Address", ({ enumerable: true, get: function () { return address_1.getCreate2Address; } })); Object.defineProperty(exports, "getContractAddress", ({ enumerable: true, get: function () { return address_1.getContractAddress; } })); Object.defineProperty(exports, "getIcapAddress", ({ enumerable: true, get: function () { return address_1.getIcapAddress; } })); Object.defineProperty(exports, "isAddress", ({ enumerable: true, get: function () { return address_1.isAddress; } })); var base64 = __importStar(__webpack_require__(4089)); exports.base64 = base64; var basex_1 = __webpack_require__(57727); Object.defineProperty(exports, "base58", ({ enumerable: true, get: function () { return basex_1.Base58; } })); var bytes_1 = __webpack_require__(16441); Object.defineProperty(exports, "arrayify", ({ enumerable: true, get: function () { return bytes_1.arrayify; } })); Object.defineProperty(exports, "concat", ({ enumerable: true, get: function () { return bytes_1.concat; } })); Object.defineProperty(exports, "hexConcat", ({ enumerable: true, get: function () { return bytes_1.hexConcat; } })); Object.defineProperty(exports, "hexDataSlice", ({ enumerable: true, get: function () { return bytes_1.hexDataSlice; } })); Object.defineProperty(exports, "hexDataLength", ({ enumerable: true, get: function () { return bytes_1.hexDataLength; } })); Object.defineProperty(exports, "hexlify", ({ enumerable: true, get: function () { return bytes_1.hexlify; } })); Object.defineProperty(exports, "hexStripZeros", ({ enumerable: true, get: function () { return bytes_1.hexStripZeros; } })); Object.defineProperty(exports, "hexValue", ({ enumerable: true, get: function () { return bytes_1.hexValue; } })); Object.defineProperty(exports, "hexZeroPad", ({ enumerable: true, get: function () { return bytes_1.hexZeroPad; } })); Object.defineProperty(exports, "isBytes", ({ enumerable: true, get: function () { return bytes_1.isBytes; } })); Object.defineProperty(exports, "isBytesLike", ({ enumerable: true, get: function () { return bytes_1.isBytesLike; } })); Object.defineProperty(exports, "isHexString", ({ enumerable: true, get: function () { return bytes_1.isHexString; } })); Object.defineProperty(exports, "joinSignature", ({ enumerable: true, get: function () { return bytes_1.joinSignature; } })); Object.defineProperty(exports, "zeroPad", ({ enumerable: true, get: function () { return bytes_1.zeroPad; } })); Object.defineProperty(exports, "splitSignature", ({ enumerable: true, get: function () { return bytes_1.splitSignature; } })); Object.defineProperty(exports, "stripZeros", ({ enumerable: true, get: function () { return bytes_1.stripZeros; } })); var hash_1 = __webpack_require__(75931); Object.defineProperty(exports, "_TypedDataEncoder", ({ enumerable: true, get: function () { return hash_1._TypedDataEncoder; } })); Object.defineProperty(exports, "dnsEncode", ({ enumerable: true, get: function () { return hash_1.dnsEncode; } })); Object.defineProperty(exports, "hashMessage", ({ enumerable: true, get: function () { return hash_1.hashMessage; } })); Object.defineProperty(exports, "id", ({ enumerable: true, get: function () { return hash_1.id; } })); Object.defineProperty(exports, "isValidName", ({ enumerable: true, get: function () { return hash_1.isValidName; } })); Object.defineProperty(exports, "namehash", ({ enumerable: true, get: function () { return hash_1.namehash; } })); var hdnode_1 = __webpack_require__(84178); Object.defineProperty(exports, "defaultPath", ({ enumerable: true, get: function () { return hdnode_1.defaultPath; } })); Object.defineProperty(exports, "entropyToMnemonic", ({ enumerable: true, get: function () { return hdnode_1.entropyToMnemonic; } })); Object.defineProperty(exports, "getAccountPath", ({ enumerable: true, get: function () { return hdnode_1.getAccountPath; } })); Object.defineProperty(exports, "HDNode", ({ enumerable: true, get: function () { return hdnode_1.HDNode; } })); Object.defineProperty(exports, "isValidMnemonic", ({ enumerable: true, get: function () { return hdnode_1.isValidMnemonic; } })); Object.defineProperty(exports, "mnemonicToEntropy", ({ enumerable: true, get: function () { return hdnode_1.mnemonicToEntropy; } })); Object.defineProperty(exports, "mnemonicToSeed", ({ enumerable: true, get: function () { return hdnode_1.mnemonicToSeed; } })); var json_wallets_1 = __webpack_require__(64341); Object.defineProperty(exports, "getJsonWalletAddress", ({ enumerable: true, get: function () { return json_wallets_1.getJsonWalletAddress; } })); var keccak256_1 = __webpack_require__(38197); Object.defineProperty(exports, "keccak256", ({ enumerable: true, get: function () { return keccak256_1.keccak256; } })); var logger_1 = __webpack_require__(1581); Object.defineProperty(exports, "Logger", ({ enumerable: true, get: function () { return logger_1.Logger; } })); var sha2_1 = __webpack_require__(91278); Object.defineProperty(exports, "computeHmac", ({ enumerable: true, get: function () { return sha2_1.computeHmac; } })); Object.defineProperty(exports, "ripemd160", ({ enumerable: true, get: function () { return sha2_1.ripemd160; } })); Object.defineProperty(exports, "sha256", ({ enumerable: true, get: function () { return sha2_1.sha256; } })); Object.defineProperty(exports, "sha512", ({ enumerable: true, get: function () { return sha2_1.sha512; } })); var solidity_1 = __webpack_require__(31886); Object.defineProperty(exports, "solidityKeccak256", ({ enumerable: true, get: function () { return solidity_1.keccak256; } })); Object.defineProperty(exports, "solidityPack", ({ enumerable: true, get: function () { return solidity_1.pack; } })); Object.defineProperty(exports, "soliditySha256", ({ enumerable: true, get: function () { return solidity_1.sha256; } })); var random_1 = __webpack_require__(22118); Object.defineProperty(exports, "randomBytes", ({ enumerable: true, get: function () { return random_1.randomBytes; } })); Object.defineProperty(exports, "shuffled", ({ enumerable: true, get: function () { return random_1.shuffled; } })); var properties_1 = __webpack_require__(6881); Object.defineProperty(exports, "checkProperties", ({ enumerable: true, get: function () { return properties_1.checkProperties; } })); Object.defineProperty(exports, "deepCopy", ({ enumerable: true, get: function () { return properties_1.deepCopy; } })); Object.defineProperty(exports, "defineReadOnly", ({ enumerable: true, get: function () { return properties_1.defineReadOnly; } })); Object.defineProperty(exports, "getStatic", ({ enumerable: true, get: function () { return properties_1.getStatic; } })); Object.defineProperty(exports, "resolveProperties", ({ enumerable: true, get: function () { return properties_1.resolveProperties; } })); Object.defineProperty(exports, "shallowCopy", ({ enumerable: true, get: function () { return properties_1.shallowCopy; } })); var RLP = __importStar(__webpack_require__(59052)); exports.RLP = RLP; var signing_key_1 = __webpack_require__(67669); Object.defineProperty(exports, "computePublicKey", ({ enumerable: true, get: function () { return signing_key_1.computePublicKey; } })); Object.defineProperty(exports, "recoverPublicKey", ({ enumerable: true, get: function () { return signing_key_1.recoverPublicKey; } })); Object.defineProperty(exports, "SigningKey", ({ enumerable: true, get: function () { return signing_key_1.SigningKey; } })); var strings_1 = __webpack_require__(62741); Object.defineProperty(exports, "formatBytes32String", ({ enumerable: true, get: function () { return strings_1.formatBytes32String; } })); Object.defineProperty(exports, "nameprep", ({ enumerable: true, get: function () { return strings_1.nameprep; } })); Object.defineProperty(exports, "parseBytes32String", ({ enumerable: true, get: function () { return strings_1.parseBytes32String; } })); Object.defineProperty(exports, "_toEscapedUtf8String", ({ enumerable: true, get: function () { return strings_1._toEscapedUtf8String; } })); Object.defineProperty(exports, "toUtf8Bytes", ({ enumerable: true, get: function () { return strings_1.toUtf8Bytes; } })); Object.defineProperty(exports, "toUtf8CodePoints", ({ enumerable: true, get: function () { return strings_1.toUtf8CodePoints; } })); Object.defineProperty(exports, "toUtf8String", ({ enumerable: true, get: function () { return strings_1.toUtf8String; } })); Object.defineProperty(exports, "Utf8ErrorFuncs", ({ enumerable: true, get: function () { return strings_1.Utf8ErrorFuncs; } })); var transactions_1 = __webpack_require__(83875); Object.defineProperty(exports, "accessListify", ({ enumerable: true, get: function () { return transactions_1.accessListify; } })); Object.defineProperty(exports, "computeAddress", ({ enumerable: true, get: function () { return transactions_1.computeAddress; } })); Object.defineProperty(exports, "parseTransaction", ({ enumerable: true, get: function () { return transactions_1.parse; } })); Object.defineProperty(exports, "recoverAddress", ({ enumerable: true, get: function () { return transactions_1.recoverAddress; } })); Object.defineProperty(exports, "serializeTransaction", ({ enumerable: true, get: function () { return transactions_1.serialize; } })); Object.defineProperty(exports, "TransactionTypes", ({ enumerable: true, get: function () { return transactions_1.TransactionTypes; } })); var units_1 = __webpack_require__(61744); Object.defineProperty(exports, "commify", ({ enumerable: true, get: function () { return units_1.commify; } })); Object.defineProperty(exports, "formatEther", ({ enumerable: true, get: function () { return units_1.formatEther; } })); Object.defineProperty(exports, "parseEther", ({ enumerable: true, get: function () { return units_1.parseEther; } })); Object.defineProperty(exports, "formatUnits", ({ enumerable: true, get: function () { return units_1.formatUnits; } })); Object.defineProperty(exports, "parseUnits", ({ enumerable: true, get: function () { return units_1.parseUnits; } })); var wallet_1 = __webpack_require__(79911); Object.defineProperty(exports, "verifyMessage", ({ enumerable: true, get: function () { return wallet_1.verifyMessage; } })); Object.defineProperty(exports, "verifyTypedData", ({ enumerable: true, get: function () { return wallet_1.verifyTypedData; } })); var web_1 = __webpack_require__(37707); Object.defineProperty(exports, "_fetchData", ({ enumerable: true, get: function () { return web_1._fetchData; } })); Object.defineProperty(exports, "fetchJson", ({ enumerable: true, get: function () { return web_1.fetchJson; } })); Object.defineProperty(exports, "poll", ({ enumerable: true, get: function () { return web_1.poll; } })); //////////////////////// // Enums var sha2_2 = __webpack_require__(91278); Object.defineProperty(exports, "SupportedAlgorithm", ({ enumerable: true, get: function () { return sha2_2.SupportedAlgorithm; } })); var strings_2 = __webpack_require__(62741); Object.defineProperty(exports, "UnicodeNormalizationForm", ({ enumerable: true, get: function () { return strings_2.UnicodeNormalizationForm; } })); Object.defineProperty(exports, "Utf8ErrorReason", ({ enumerable: true, get: function () { return strings_2.Utf8ErrorReason; } })); //# sourceMappingURL=utils.js.map /***/ }), /***/ 26729: /***/ (function(module) { "use strict"; var has = Object.prototype.hasOwnProperty , prefix = '~'; /** * Constructor to create a storage for our `EE` objects. * An `Events` instance is a plain object whose properties are event names. * * @constructor * @private */ function Events() {} // // We try to not inherit from `Object.prototype`. In some engines creating an // instance in this way is faster than calling `Object.create(null)` directly. // If `Object.create(null)` is not supported we prefix the event names with a // character to make sure that the built-in object properties are not // overridden or used as an attack vector. // if (Object.create) { Events.prototype = Object.create(null); // // This hack is needed because the `__proto__` property is still inherited in // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5. // if (!new Events().__proto__) prefix = false; } /** * Representation of a single event listener. * * @param {Function} fn The listener function. * @param {*} context The context to invoke the listener with. * @param {Boolean} [once=false] Specify if the listener is a one-time listener. * @constructor * @private */ function EE(fn, context, once) { this.fn = fn; this.context = context; this.once = once || false; } /** * Add a listener for a given event. * * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. * @param {(String|Symbol)} event The event name. * @param {Function} fn The listener function. * @param {*} context The context to invoke the listener with. * @param {Boolean} once Specify if the listener is a one-time listener. * @returns {EventEmitter} * @private */ function addListener(emitter, event, fn, context, once) { if (typeof fn !== 'function') { throw new TypeError('The listener must be a function'); } var listener = new EE(fn, context || emitter, once) , evt = prefix ? prefix + event : event; if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++; else if (!emitter._events[evt].fn) emitter._events[evt].push(listener); else emitter._events[evt] = [emitter._events[evt], listener]; return emitter; } /** * Clear event by name. * * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. * @param {(String|Symbol)} evt The Event name. * @private */ function clearEvent(emitter, evt) { if (--emitter._eventsCount === 0) emitter._events = new Events(); else delete emitter._events[evt]; } /** * Minimal `EventEmitter` interface that is molded against the Node.js * `EventEmitter` interface. * * @constructor * @public */ function EventEmitter() { this._events = new Events(); this._eventsCount = 0; } /** * Return an array listing the events for which the emitter has registered * listeners. * * @returns {Array} * @public */ EventEmitter.prototype.eventNames = function eventNames() { var names = [] , events , name; if (this._eventsCount === 0) return names; for (name in (events = this._events)) { if (has.call(events, name)) names.push(prefix ? name.slice(1) : name); } if (Object.getOwnPropertySymbols) { return names.concat(Object.getOwnPropertySymbols(events)); } return names; }; /** * Return the listeners registered for a given event. * * @param {(String|Symbol)} event The event name. * @returns {Array} The registered listeners. * @public */ EventEmitter.prototype.listeners = function listeners(event) { var evt = prefix ? prefix + event : event , handlers = this._events[evt]; if (!handlers) return []; if (handlers.fn) return [handlers.fn]; for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) { ee[i] = handlers[i].fn; } return ee; }; /** * Return the number of listeners listening to a given event. * * @param {(String|Symbol)} event The event name. * @returns {Number} The number of listeners. * @public */ EventEmitter.prototype.listenerCount = function listenerCount(event) { var evt = prefix ? prefix + event : event , listeners = this._events[evt]; if (!listeners) return 0; if (listeners.fn) return 1; return listeners.length; }; /** * Calls each of the listeners registered for a given event. * * @param {(String|Symbol)} event The event name. * @returns {Boolean} `true` if the event had listeners, else `false`. * @public */ EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) { var evt = prefix ? prefix + event : event; if (!this._events[evt]) return false; var listeners = this._events[evt] , len = arguments.length , args , i; if (listeners.fn) { if (listeners.once) this.removeListener(event, listeners.fn, undefined, true); switch (len) { case 1: return listeners.fn.call(listeners.context), true; case 2: return listeners.fn.call(listeners.context, a1), true; case 3: return listeners.fn.call(listeners.context, a1, a2), true; case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true; case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true; case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true; } for (i = 1, args = new Array(len -1); i < len; i++) { args[i - 1] = arguments[i]; } listeners.fn.apply(listeners.context, args); } else { var length = listeners.length , j; for (i = 0; i < length; i++) { if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true); switch (len) { case 1: listeners[i].fn.call(listeners[i].context); break; case 2: listeners[i].fn.call(listeners[i].context, a1); break; case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break; case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break; default: if (!args) for (j = 1, args = new Array(len -1); j < len; j++) { args[j - 1] = arguments[j]; } listeners[i].fn.apply(listeners[i].context, args); } } } return true; }; /** * Add a listener for a given event. * * @param {(String|Symbol)} event The event name. * @param {Function} fn The listener function. * @param {*} [context=this] The context to invoke the listener with. * @returns {EventEmitter} `this`. * @public */ EventEmitter.prototype.on = function on(event, fn, context) { return addListener(this, event, fn, context, false); }; /** * Add a one-time listener for a given event. * * @param {(String|Symbol)} event The event name. * @param {Function} fn The listener function. * @param {*} [context=this] The context to invoke the listener with. * @returns {EventEmitter} `this`. * @public */ EventEmitter.prototype.once = function once(event, fn, context) { return addListener(this, event, fn, context, true); }; /** * Remove the listeners of a given event. * * @param {(String|Symbol)} event The event name. * @param {Function} fn Only remove the listeners that match this function. * @param {*} context Only remove the listeners that have this context. * @param {Boolean} once Only remove one-time listeners. * @returns {EventEmitter} `this`. * @public */ EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) { var evt = prefix ? prefix + event : event; if (!this._events[evt]) return this; if (!fn) { clearEvent(this, evt); return this; } var listeners = this._events[evt]; if (listeners.fn) { if ( listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context) ) { clearEvent(this, evt); } } else { for (var i = 0, events = [], length = listeners.length; i < length; i++) { if ( listeners[i].fn !== fn || (once && !listeners[i].once) || (context && listeners[i].context !== context) ) { events.push(listeners[i]); } } // // Reset the array, or remove it completely if we have no more listeners. // if (events.length) this._events[evt] = events.length === 1 ? events[0] : events; else clearEvent(this, evt); } return this; }; /** * Remove all listeners, or those of the specified event. * * @param {(String|Symbol)} [event] The event name. * @returns {EventEmitter} `this`. * @public */ EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) { var evt; if (event) { evt = prefix ? prefix + event : event; if (this._events[evt]) clearEvent(this, evt); } else { this._events = new Events(); this._eventsCount = 0; } return this; }; // // Alias methods names because people roll like that. // EventEmitter.prototype.off = EventEmitter.prototype.removeListener; EventEmitter.prototype.addListener = EventEmitter.prototype.on; // // Expose the prefix. // EventEmitter.prefixed = prefix; // // Allow `EventEmitter` to be imported as module namespace. // EventEmitter.EventEmitter = EventEmitter; // // Expose the module. // if (true) { module.exports = EventEmitter; } /***/ }), /***/ 17187: /***/ (function(module) { "use strict"; // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. var R = typeof Reflect === 'object' ? Reflect : null var ReflectApply = R && typeof R.apply === 'function' ? R.apply : function ReflectApply(target, receiver, args) { return Function.prototype.apply.call(target, receiver, args); } var ReflectOwnKeys if (R && typeof R.ownKeys === 'function') { ReflectOwnKeys = R.ownKeys } else if (Object.getOwnPropertySymbols) { ReflectOwnKeys = function ReflectOwnKeys(target) { return Object.getOwnPropertyNames(target) .concat(Object.getOwnPropertySymbols(target)); }; } else { ReflectOwnKeys = function ReflectOwnKeys(target) { return Object.getOwnPropertyNames(target); }; } function ProcessEmitWarning(warning) { if (console && console.warn) console.warn(warning); } var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) { return value !== value; } function EventEmitter() { EventEmitter.init.call(this); } module.exports = EventEmitter; module.exports.once = once; // Backwards-compat with node 0.10.x EventEmitter.EventEmitter = EventEmitter; EventEmitter.prototype._events = undefined; EventEmitter.prototype._eventsCount = 0; EventEmitter.prototype._maxListeners = undefined; // By default EventEmitters will print a warning if more than 10 listeners are // added to it. This is a useful default which helps finding memory leaks. var defaultMaxListeners = 10; function checkListener(listener) { if (typeof listener !== 'function') { throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); } } Object.defineProperty(EventEmitter, 'defaultMaxListeners', { enumerable: true, get: function() { return defaultMaxListeners; }, set: function(arg) { if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) { throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.'); } defaultMaxListeners = arg; } }); EventEmitter.init = function() { if (this._events === undefined || this._events === Object.getPrototypeOf(this)._events) { this._events = Object.create(null); this._eventsCount = 0; } this._maxListeners = this._maxListeners || undefined; }; // Obviously not all Emitters should be limited to 10. This function allows // that to be increased. Set to zero for unlimited. EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) { throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.'); } this._maxListeners = n; return this; }; function _getMaxListeners(that) { if (that._maxListeners === undefined) return EventEmitter.defaultMaxListeners; return that._maxListeners; } EventEmitter.prototype.getMaxListeners = function getMaxListeners() { return _getMaxListeners(this); }; EventEmitter.prototype.emit = function emit(type) { var args = []; for (var i = 1; i < arguments.length; i++) args.push(arguments[i]); var doError = (type === 'error'); var events = this._events; if (events !== undefined) doError = (doError && events.error === undefined); else if (!doError) return false; // If there is no 'error' event listener then throw. if (doError) { var er; if (args.length > 0) er = args[0]; if (er instanceof Error) { // Note: The comments on the `throw` lines are intentional, they show // up in Node's output if this results in an unhandled exception. throw er; // Unhandled 'error' event } // At least give some kind of context to the user var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : '')); err.context = er; throw err; // Unhandled 'error' event } var handler = events[type]; if (handler === undefined) return false; if (typeof handler === 'function') { ReflectApply(handler, this, args); } else { var len = handler.length; var listeners = arrayClone(handler, len); for (var i = 0; i < len; ++i) ReflectApply(listeners[i], this, args); } return true; }; function _addListener(target, type, listener, prepend) { var m; var events; var existing; checkListener(listener); events = target._events; if (events === undefined) { events = target._events = Object.create(null); target._eventsCount = 0; } else { // To avoid recursion in the case that type === "newListener"! Before // adding it to the listeners, first emit "newListener". if (events.newListener !== undefined) { target.emit('newListener', type, listener.listener ? listener.listener : listener); // Re-assign `events` because a newListener handler could have caused the // this._events to be assigned to a new object events = target._events; } existing = events[type]; } if (existing === undefined) { // Optimize the case of one listener. Don't need the extra array object. existing = events[type] = listener; ++target._eventsCount; } else { if (typeof existing === 'function') { // Adding the second element, need to change to array. existing = events[type] = prepend ? [listener, existing] : [existing, listener]; // If we've already got an array, just append. } else if (prepend) { existing.unshift(listener); } else { existing.push(listener); } // Check for listener leak m = _getMaxListeners(target); if (m > 0 && existing.length > m && !existing.warned) { existing.warned = true; // No error code for this since it is a Warning // eslint-disable-next-line no-restricted-syntax var w = new Error('Possible EventEmitter memory leak detected. ' + existing.length + ' ' + String(type) + ' listeners ' + 'added. Use emitter.setMaxListeners() to ' + 'increase limit'); w.name = 'MaxListenersExceededWarning'; w.emitter = target; w.type = type; w.count = existing.length; ProcessEmitWarning(w); } } return target; } EventEmitter.prototype.addListener = function addListener(type, listener) { return _addListener(this, type, listener, false); }; EventEmitter.prototype.on = EventEmitter.prototype.addListener; EventEmitter.prototype.prependListener = function prependListener(type, listener) { return _addListener(this, type, listener, true); }; function onceWrapper() { if (!this.fired) { this.target.removeListener(this.type, this.wrapFn); this.fired = true; if (arguments.length === 0) return this.listener.call(this.target); return this.listener.apply(this.target, arguments); } } function _onceWrap(target, type, listener) { var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; var wrapped = onceWrapper.bind(state); wrapped.listener = listener; state.wrapFn = wrapped; return wrapped; } EventEmitter.prototype.once = function once(type, listener) { checkListener(listener); this.on(type, _onceWrap(this, type, listener)); return this; }; EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) { checkListener(listener); this.prependListener(type, _onceWrap(this, type, listener)); return this; }; // Emits a 'removeListener' event if and only if the listener was removed. EventEmitter.prototype.removeListener = function removeListener(type, listener) { var list, events, position, i, originalListener; checkListener(listener); events = this._events; if (events === undefined) return this; list = events[type]; if (list === undefined) return this; if (list === listener || list.listener === listener) { if (--this._eventsCount === 0) this._events = Object.create(null); else { delete events[type]; if (events.removeListener) this.emit('removeListener', type, list.listener || listener); } } else if (typeof list !== 'function') { position = -1; for (i = list.length - 1; i >= 0; i--) { if (list[i] === listener || list[i].listener === listener) { originalListener = list[i].listener; position = i; break; } } if (position < 0) return this; if (position === 0) list.shift(); else { spliceOne(list, position); } if (list.length === 1) events[type] = list[0]; if (events.removeListener !== undefined) this.emit('removeListener', type, originalListener || listener); } return this; }; EventEmitter.prototype.off = EventEmitter.prototype.removeListener; EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) { var listeners, events, i; events = this._events; if (events === undefined) return this; // not listening for removeListener, no need to emit if (events.removeListener === undefined) { if (arguments.length === 0) { this._events = Object.create(null); this._eventsCount = 0; } else if (events[type] !== undefined) { if (--this._eventsCount === 0) this._events = Object.create(null); else delete events[type]; } return this; } // emit removeListener for all listeners on all events if (arguments.length === 0) { var keys = Object.keys(events); var key; for (i = 0; i < keys.length; ++i) { key = keys[i]; if (key === 'removeListener') continue; this.removeAllListeners(key); } this.removeAllListeners('removeListener'); this._events = Object.create(null); this._eventsCount = 0; return this; } listeners = events[type]; if (typeof listeners === 'function') { this.removeListener(type, listeners); } else if (listeners !== undefined) { // LIFO order for (i = listeners.length - 1; i >= 0; i--) { this.removeListener(type, listeners[i]); } } return this; }; function _listeners(target, type, unwrap) { var events = target._events; if (events === undefined) return []; var evlistener = events[type]; if (evlistener === undefined) return []; if (typeof evlistener === 'function') return unwrap ? [evlistener.listener || evlistener] : [evlistener]; return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); } EventEmitter.prototype.listeners = function listeners(type) { return _listeners(this, type, true); }; EventEmitter.prototype.rawListeners = function rawListeners(type) { return _listeners(this, type, false); }; EventEmitter.listenerCount = function(emitter, type) { if (typeof emitter.listenerCount === 'function') { return emitter.listenerCount(type); } else { return listenerCount.call(emitter, type); } }; EventEmitter.prototype.listenerCount = listenerCount; function listenerCount(type) { var events = this._events; if (events !== undefined) { var evlistener = events[type]; if (typeof evlistener === 'function') { return 1; } else if (evlistener !== undefined) { return evlistener.length; } } return 0; } EventEmitter.prototype.eventNames = function eventNames() { return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; }; function arrayClone(arr, n) { var copy = new Array(n); for (var i = 0; i < n; ++i) copy[i] = arr[i]; return copy; } function spliceOne(list, index) { for (; index + 1 < list.length; index++) list[index] = list[index + 1]; list.pop(); } function unwrapListeners(arr) { var ret = new Array(arr.length); for (var i = 0; i < ret.length; ++i) { ret[i] = arr[i].listener || arr[i]; } return ret; } function once(emitter, name) { return new Promise(function (resolve, reject) { function errorListener(err) { emitter.removeListener(name, resolver); reject(err); } function resolver() { if (typeof emitter.removeListener === 'function') { emitter.removeListener('error', errorListener); } resolve([].slice.call(arguments)); }; eventTargetAgnosticAddListener(emitter, name, resolver, { once: true }); if (name !== 'error') { addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true }); } }); } function addErrorHandlerIfEventEmitter(emitter, handler, flags) { if (typeof emitter.on === 'function') { eventTargetAgnosticAddListener(emitter, 'error', handler, flags); } } function eventTargetAgnosticAddListener(emitter, name, listener, flags) { if (typeof emitter.on === 'function') { if (flags.once) { emitter.once(name, listener); } else { emitter.on(name, listener); } } else if (typeof emitter.addEventListener === 'function') { // EventTarget does not have `error` event semantics like Node // EventEmitters, we do not listen for `error` events here. emitter.addEventListener(name, function wrapListener(arg) { // IE does not have builtin `{ once: true }` support so we // have to do it manually. if (flags.once) { emitter.removeEventListener(name, wrapListener); } listener(arg); }); } else { throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter); } } /***/ }), /***/ 72445: /***/ (function(module) { "use strict"; module.exports = function ReactNativeFile(_ref) { var uri = _ref.uri, name = _ref.name, type = _ref.type; this.uri = uri; this.name = name; this.type = type; }; /***/ }), /***/ 40804: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var defaultIsExtractableFile = __webpack_require__(51268); module.exports = function extractFiles(value, path, isExtractableFile) { if (path === void 0) { path = ''; } if (isExtractableFile === void 0) { isExtractableFile = defaultIsExtractableFile; } var clone; var files = new Map(); function addFile(paths, file) { var storedPaths = files.get(file); if (storedPaths) storedPaths.push.apply(storedPaths, paths); else files.set(file, paths); } if (isExtractableFile(value)) { clone = null; addFile([path], value); } else { var prefix = path ? path + '.' : ''; if (typeof FileList !== 'undefined' && value instanceof FileList) clone = Array.prototype.map.call(value, function (file, i) { addFile(['' + prefix + i], file); return null; }); else if (Array.isArray(value)) clone = value.map(function (child, i) { var result = extractFiles(child, '' + prefix + i, isExtractableFile); result.files.forEach(addFile); return result.clone; }); else if (value && value.constructor === Object) { clone = {}; for (var i in value) { var result = extractFiles(value[i], '' + prefix + i, isExtractableFile); result.files.forEach(addFile); clone[i] = result.clone; } } else clone = value; } return { clone: clone, files: files, }; }; /***/ }), /***/ 34823: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; exports.ReactNativeFile = __webpack_require__(72445); exports.extractFiles = __webpack_require__(40804); exports.isExtractableFile = __webpack_require__(51268); /***/ }), /***/ 51268: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var ReactNativeFile = __webpack_require__(72445); module.exports = function isExtractableFile(value) { return ( (typeof File !== 'undefined' && value instanceof File) || (typeof Blob !== 'undefined' && value instanceof Blob) || value instanceof ReactNativeFile ); }; /***/ }), /***/ 35035: /***/ (function(module) { "use strict"; module.exports = function (data, opts) { if (!opts) opts = {}; if (typeof opts === 'function') opts = { cmp: opts }; var cycles = (typeof opts.cycles === 'boolean') ? opts.cycles : false; var cmp = opts.cmp && (function (f) { return function (node) { return function (a, b) { var aobj = { key: a, value: node[a] }; var bobj = { key: b, value: node[b] }; return f(aobj, bobj); }; }; })(opts.cmp); var seen = []; return (function stringify (node) { if (node && node.toJSON && typeof node.toJSON === 'function') { node = node.toJSON(); } if (node === undefined) return; if (typeof node == 'number') return isFinite(node) ? '' + node : 'null'; if (typeof node !== 'object') return JSON.stringify(node); var i, out; if (Array.isArray(node)) { out = '['; for (i = 0; i < node.length; i++) { if (i) out += ','; out += stringify(node[i]) || 'null'; } return out + ']'; } if (node === null) return 'null'; if (seen.indexOf(node) !== -1) { if (cycles) return JSON.stringify('__cycle__'); throw new TypeError('Converting circular structure to JSON'); } var seenIndex = seen.push(node) - 1; var keys = Object.keys(node).sort(cmp && cmp(node)); out = ''; for (i = 0; i < keys.length; i++) { var key = keys[i]; var value = stringify(node[key]); if (!value) continue; if (out) out += ','; out += JSON.stringify(key) + ':' + value; } seen.splice(seenIndex, 1); return '{' + out + '}'; })(data); }; /***/ }), /***/ 92806: /***/ (function(module) { "use strict"; module.exports = function (obj, predicate) { var ret = {}; var keys = Object.keys(obj); var isArr = Array.isArray(predicate); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var val = obj[key]; if (isArr ? predicate.indexOf(key) !== -1 : predicate(key, val, obj)) { ret[key] = val; } } return ret; }; /***/ }), /***/ 6230: /***/ (function(module) { /* eslint-env browser */ module.exports = typeof self == 'object' ? self.FormData : window.FormData; /***/ }), /***/ 78458: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); var extract_files_1 = __webpack_require__(34823); var form_data_1 = __importDefault(__webpack_require__(6230)); var defaultJsonSerializer_1 = __webpack_require__(60456); /** * Duck type if NodeJS stream * https://github.com/sindresorhus/is-stream/blob/3750505b0727f6df54324784fe369365ef78841e/index.js#L3 */ var isExtractableFileEnhanced = function (value) { return extract_files_1.isExtractableFile(value) || (value !== null && typeof value === 'object' && typeof value.pipe === 'function'); }; /** * Returns Multipart Form if body contains files * (https://github.com/jaydenseric/graphql-multipart-request-spec) * Otherwise returns JSON */ function createRequestBody(query, variables, operationName, jsonSerializer) { if (jsonSerializer === void 0) { jsonSerializer = defaultJsonSerializer_1.defaultJsonSerializer; } var _a = extract_files_1.extractFiles({ query: query, variables: variables, operationName: operationName }, '', isExtractableFileEnhanced), clone = _a.clone, files = _a.files; if (files.size === 0) { if (!Array.isArray(query)) { return jsonSerializer.stringify(clone); } if (typeof variables !== 'undefined' && !Array.isArray(variables)) { throw new Error('Cannot create request body with given variable type, array expected'); } // Batch support var payload = query.reduce(function (accu, currentQuery, index) { accu.push({ query: currentQuery, variables: variables ? variables[index] : undefined }); return accu; }, []); return jsonSerializer.stringify(payload); } var Form = typeof FormData === 'undefined' ? form_data_1.default : FormData; var form = new Form(); form.append('operations', jsonSerializer.stringify(clone)); var map = {}; var i = 0; files.forEach(function (paths) { map[++i] = paths; }); form.append('map', jsonSerializer.stringify(map)); i = 0; files.forEach(function (paths, file) { form.append("" + ++i, file); }); return form; } exports["default"] = createRequestBody; //# sourceMappingURL=createRequestBody.js.map /***/ }), /***/ 60456: /***/ (function(__unused_webpack_module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.defaultJsonSerializer = void 0; exports.defaultJsonSerializer = { parse: JSON.parse, stringify: JSON.stringify }; //# sourceMappingURL=defaultJsonSerializer.js.map /***/ }), /***/ 28687: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __generator = (this && this.__generator) || function (thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.gql = exports.batchRequests = exports.request = exports.rawRequest = exports.GraphQLClient = exports.ClientError = void 0; var cross_fetch_1 = __importStar(__webpack_require__(54098)), CrossFetch = cross_fetch_1; var parser_1 = __webpack_require__(86355); var printer_1 = __webpack_require__(62938); var createRequestBody_1 = __importDefault(__webpack_require__(78458)); var defaultJsonSerializer_1 = __webpack_require__(60456); var parseArgs_1 = __webpack_require__(32980); var types_1 = __webpack_require__(8308); Object.defineProperty(exports, "ClientError", ({ enumerable: true, get: function () { return types_1.ClientError; } })); /** * Convert the given headers configuration into a plain object. */ var resolveHeaders = function (headers) { var oHeaders = {}; if (headers) { if ((typeof Headers !== 'undefined' && headers instanceof Headers) || headers instanceof CrossFetch.Headers) { oHeaders = HeadersInstanceToPlainObject(headers); } else if (Array.isArray(headers)) { headers.forEach(function (_a) { var name = _a[0], value = _a[1]; oHeaders[name] = value; }); } else { oHeaders = headers; } } return oHeaders; }; /** * Clean a GraphQL document to send it via a GET query * * @param {string} str GraphQL query * @returns {string} Cleaned query */ var queryCleanner = function (str) { return str.replace(/([\s,]|#[^\n\r]+)+/g, ' ').trim(); }; /** * Create query string for GraphQL request * * @param {object} param0 - * * @param {string|string[]} param0.query the GraphQL document or array of document if it's a batch request * @param {string|undefined} param0.operationName the GraphQL operation name * @param {any|any[]} param0.variables the GraphQL variables to use */ var buildGetQueryParams = function (_a) { var query = _a.query, variables = _a.variables, operationName = _a.operationName, jsonSerializer = _a.jsonSerializer; if (!Array.isArray(query)) { var search = ["query=" + encodeURIComponent(queryCleanner(query))]; if (variables) { search.push("variables=" + encodeURIComponent(jsonSerializer.stringify(variables))); } if (operationName) { search.push("operationName=" + encodeURIComponent(operationName)); } return search.join('&'); } if (typeof variables !== 'undefined' && !Array.isArray(variables)) { throw new Error('Cannot create query with given variable type, array expected'); } // Batch support var payload = query.reduce(function (accu, currentQuery, index) { accu.push({ query: queryCleanner(currentQuery), variables: variables ? jsonSerializer.stringify(variables[index]) : undefined, }); return accu; }, []); return "query=" + encodeURIComponent(jsonSerializer.stringify(payload)); }; /** * Fetch data using POST method */ var post = function (_a) { var url = _a.url, query = _a.query, variables = _a.variables, operationName = _a.operationName, headers = _a.headers, fetch = _a.fetch, fetchOptions = _a.fetchOptions; return __awaiter(void 0, void 0, void 0, function () { var body; return __generator(this, function (_b) { switch (_b.label) { case 0: body = createRequestBody_1.default(query, variables, operationName, fetchOptions.jsonSerializer); return [4 /*yield*/, fetch(url, __assign({ method: 'POST', headers: __assign(__assign({}, (typeof body === 'string' ? { 'Content-Type': 'application/json' } : {})), headers), body: body }, fetchOptions))]; case 1: return [2 /*return*/, _b.sent()]; } }); }); }; /** * Fetch data using GET method */ var get = function (_a) { var url = _a.url, query = _a.query, variables = _a.variables, operationName = _a.operationName, headers = _a.headers, fetch = _a.fetch, fetchOptions = _a.fetchOptions; return __awaiter(void 0, void 0, void 0, function () { var queryParams; return __generator(this, function (_b) { switch (_b.label) { case 0: queryParams = buildGetQueryParams({ query: query, variables: variables, operationName: operationName, jsonSerializer: fetchOptions.jsonSerializer }); return [4 /*yield*/, fetch(url + "?" + queryParams, __assign({ method: 'GET', headers: headers }, fetchOptions))]; case 1: return [2 /*return*/, _b.sent()]; } }); }); }; /** * GraphQL Client. */ var GraphQLClient = /** @class */ (function () { function GraphQLClient(url, options) { this.url = url; this.options = options || {}; } GraphQLClient.prototype.rawRequest = function (queryOrOptions, variables, requestHeaders) { return __awaiter(this, void 0, void 0, function () { var rawRequestOptions, _a, headers, _b, fetch, _c, method, fetchOptions, url, operationName; return __generator(this, function (_d) { rawRequestOptions = parseArgs_1.parseRawRequestArgs(queryOrOptions, variables, requestHeaders); _a = this.options, headers = _a.headers, _b = _a.fetch, fetch = _b === void 0 ? cross_fetch_1.default : _b, _c = _a.method, method = _c === void 0 ? 'POST' : _c, fetchOptions = __rest(_a, ["headers", "fetch", "method"]); url = this.url; if (rawRequestOptions.signal !== undefined) { fetchOptions.signal = rawRequestOptions.signal; } operationName = resolveRequestDocument(rawRequestOptions.query).operationName; return [2 /*return*/, makeRequest({ url: url, query: rawRequestOptions.query, variables: rawRequestOptions.variables, headers: __assign(__assign({}, resolveHeaders(headers)), resolveHeaders(rawRequestOptions.requestHeaders)), operationName: operationName, fetch: fetch, method: method, fetchOptions: fetchOptions, })]; }); }); }; GraphQLClient.prototype.request = function (documentOrOptions, variables, requestHeaders) { return __awaiter(this, void 0, void 0, function () { var requestOptions, _a, headers, _b, fetch, _c, method, fetchOptions, url, _d, query, operationName, data; return __generator(this, function (_e) { switch (_e.label) { case 0: requestOptions = parseArgs_1.parseRequestArgs(documentOrOptions, variables, requestHeaders); _a = this.options, headers = _a.headers, _b = _a.fetch, fetch = _b === void 0 ? cross_fetch_1.default : _b, _c = _a.method, method = _c === void 0 ? 'POST' : _c, fetchOptions = __rest(_a, ["headers", "fetch", "method"]); url = this.url; if (requestOptions.signal !== undefined) { fetchOptions.signal = requestOptions.signal; } _d = resolveRequestDocument(requestOptions.document), query = _d.query, operationName = _d.operationName; return [4 /*yield*/, makeRequest({ url: url, query: query, variables: requestOptions.variables, headers: __assign(__assign({}, resolveHeaders(headers)), resolveHeaders(requestOptions.requestHeaders)), operationName: operationName, fetch: fetch, method: method, fetchOptions: fetchOptions, })]; case 1: data = (_e.sent()).data; return [2 /*return*/, data]; } }); }); }; GraphQLClient.prototype.batchRequests = function (documentsOrOptions, requestHeaders) { return __awaiter(this, void 0, void 0, function () { var batchRequestOptions, _a, headers, _b, fetch, _c, method, fetchOptions, url, queries, variables, data; return __generator(this, function (_d) { switch (_d.label) { case 0: batchRequestOptions = parseArgs_1.parseBatchRequestArgs(documentsOrOptions, requestHeaders); _a = this.options, headers = _a.headers, _b = _a.fetch, fetch = _b === void 0 ? cross_fetch_1.default : _b, _c = _a.method, method = _c === void 0 ? 'POST' : _c, fetchOptions = __rest(_a, ["headers", "fetch", "method"]); url = this.url; if (batchRequestOptions.signal !== undefined) { fetchOptions.signal = batchRequestOptions.signal; } queries = batchRequestOptions.documents.map(function (_a) { var document = _a.document; return resolveRequestDocument(document).query; }); variables = batchRequestOptions.documents.map(function (_a) { var variables = _a.variables; return variables; }); return [4 /*yield*/, makeRequest({ url: url, query: queries, variables: variables, headers: __assign(__assign({}, resolveHeaders(headers)), resolveHeaders(batchRequestOptions.requestHeaders)), operationName: undefined, fetch: fetch, method: method, fetchOptions: fetchOptions, })]; case 1: data = (_d.sent()).data; return [2 /*return*/, data]; } }); }); }; GraphQLClient.prototype.setHeaders = function (headers) { this.options.headers = headers; return this; }; /** * Attach a header to the client. All subsequent requests will have this header. */ GraphQLClient.prototype.setHeader = function (key, value) { var _a; var headers = this.options.headers; if (headers) { // todo what if headers is in nested array form... ? //@ts-ignore headers[key] = value; } else { this.options.headers = (_a = {}, _a[key] = value, _a); } return this; }; /** * Change the client endpoint. All subsequent requests will send to this endpoint. */ GraphQLClient.prototype.setEndpoint = function (value) { this.url = value; return this; }; return GraphQLClient; }()); exports.GraphQLClient = GraphQLClient; function makeRequest(_a) { var url = _a.url, query = _a.query, variables = _a.variables, headers = _a.headers, operationName = _a.operationName, fetch = _a.fetch, _b = _a.method, method = _b === void 0 ? 'POST' : _b, fetchOptions = _a.fetchOptions; return __awaiter(this, void 0, void 0, function () { var fetcher, isBathchingQuery, response, result, successfullyReceivedData, headers_1, status_1, errorResult; return __generator(this, function (_c) { switch (_c.label) { case 0: fetcher = method.toUpperCase() === 'POST' ? post : get; isBathchingQuery = Array.isArray(query); return [4 /*yield*/, fetcher({ url: url, query: query, variables: variables, operationName: operationName, headers: headers, fetch: fetch, fetchOptions: fetchOptions, })]; case 1: response = _c.sent(); return [4 /*yield*/, getResult(response, fetchOptions.jsonSerializer)]; case 2: result = _c.sent(); successfullyReceivedData = isBathchingQuery && Array.isArray(result) ? !result.some(function (_a) { var data = _a.data; return !data; }) : !!result.data; if (response.ok && !result.errors && successfullyReceivedData) { headers_1 = response.headers, status_1 = response.status; return [2 /*return*/, __assign(__assign({}, (isBathchingQuery ? { data: result } : result)), { headers: headers_1, status: status_1 })]; } else { errorResult = typeof result === 'string' ? { error: result } : result; throw new types_1.ClientError(__assign(__assign({}, errorResult), { status: response.status, headers: response.headers }), { query: query, variables: variables }); } return [2 /*return*/]; } }); }); } function rawRequest(urlOrOptions, query, variables, requestHeaders) { return __awaiter(this, void 0, void 0, function () { var requestOptions, client; return __generator(this, function (_a) { requestOptions = parseArgs_1.parseRawRequestExtendedArgs(urlOrOptions, query, variables, requestHeaders); client = new GraphQLClient(requestOptions.url); return [2 /*return*/, client.rawRequest(__assign({}, requestOptions))]; }); }); } exports.rawRequest = rawRequest; function request(urlOrOptions, document, variables, requestHeaders) { return __awaiter(this, void 0, void 0, function () { var requestOptions, client; return __generator(this, function (_a) { requestOptions = parseArgs_1.parseRequestExtendedArgs(urlOrOptions, document, variables, requestHeaders); client = new GraphQLClient(requestOptions.url); return [2 /*return*/, client.request(__assign({}, requestOptions))]; }); }); } exports.request = request; function batchRequests(urlOrOptions, documents, requestHeaders) { return __awaiter(this, void 0, void 0, function () { var requestOptions, client; return __generator(this, function (_a) { requestOptions = parseArgs_1.parseBatchRequestsExtendedArgs(urlOrOptions, documents, requestHeaders); client = new GraphQLClient(requestOptions.url); return [2 /*return*/, client.batchRequests(__assign({}, requestOptions))]; }); }); } exports.batchRequests = batchRequests; exports["default"] = request; /** * todo */ function getResult(response, jsonSerializer) { if (jsonSerializer === void 0) { jsonSerializer = defaultJsonSerializer_1.defaultJsonSerializer; } return __awaiter(this, void 0, void 0, function () { var contentType, _a, _b; return __generator(this, function (_c) { switch (_c.label) { case 0: response.headers.forEach(function (value, key) { if (key.toLowerCase() === 'content-type') { contentType = value; } }); if (!(contentType && contentType.toLowerCase().startsWith('application/json'))) return [3 /*break*/, 2]; _b = (_a = jsonSerializer).parse; return [4 /*yield*/, response.text()]; case 1: return [2 /*return*/, _b.apply(_a, [_c.sent()])]; case 2: return [2 /*return*/, response.text()]; } }); }); } /** * helpers */ function extractOperationName(document) { var _a; var operationName = undefined; var operationDefinitions = document.definitions.filter(function (definition) { return definition.kind === 'OperationDefinition'; }); if (operationDefinitions.length === 1) { operationName = (_a = operationDefinitions[0].name) === null || _a === void 0 ? void 0 : _a.value; } return operationName; } function resolveRequestDocument(document) { if (typeof document === 'string') { var operationName_1 = undefined; try { var parsedDocument = parser_1.parse(document); operationName_1 = extractOperationName(parsedDocument); } catch (err) { // Failed parsing the document, the operationName will be undefined } return { query: document, operationName: operationName_1 }; } var operationName = extractOperationName(document); return { query: printer_1.print(document), operationName: operationName }; } /** * Convenience passthrough template tag to get the benefits of tooling for the gql template tag. This does not actually parse the input into a GraphQL DocumentNode like graphql-tag package does. It just returns the string with any variables given interpolated. Can save you a bit of performance and having to install another package. * * @example * * import { gql } from 'graphql-request' * * await request('https://foo.bar/graphql', gql`...`) * * @remarks * * Several tools in the Node GraphQL ecosystem are hardcoded to specially treat any template tag named "gql". For example see this prettier issue: https://github.com/prettier/prettier/issues/4360. Using this template tag has no runtime effect beyond variable interpolation. */ function gql(chunks) { var variables = []; for (var _i = 1; _i < arguments.length; _i++) { variables[_i - 1] = arguments[_i]; } return chunks.reduce(function (accumulator, chunk, index) { return "" + accumulator + chunk + (index in variables ? variables[index] : ''); }, ''); } exports.gql = gql; /** * Convert Headers instance into regular object */ function HeadersInstanceToPlainObject(headers) { var o = {}; headers.forEach(function (v, k) { o[k] = v; }); return o; } //# sourceMappingURL=index.js.map /***/ }), /***/ 32980: /***/ (function(__unused_webpack_module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.parseBatchRequestsExtendedArgs = exports.parseRawRequestExtendedArgs = exports.parseRequestExtendedArgs = exports.parseBatchRequestArgs = exports.parseRawRequestArgs = exports.parseRequestArgs = void 0; function parseRequestArgs(documentOrOptions, variables, requestHeaders) { return documentOrOptions.document ? documentOrOptions : { document: documentOrOptions, variables: variables, requestHeaders: requestHeaders, signal: undefined, }; } exports.parseRequestArgs = parseRequestArgs; function parseRawRequestArgs(queryOrOptions, variables, requestHeaders) { return queryOrOptions.query ? queryOrOptions : { query: queryOrOptions, variables: variables, requestHeaders: requestHeaders, signal: undefined, }; } exports.parseRawRequestArgs = parseRawRequestArgs; function parseBatchRequestArgs(documentsOrOptions, requestHeaders) { return documentsOrOptions.documents ? documentsOrOptions : { documents: documentsOrOptions, requestHeaders: requestHeaders, signal: undefined, }; } exports.parseBatchRequestArgs = parseBatchRequestArgs; function parseRequestExtendedArgs(urlOrOptions, document, variables, requestHeaders) { return urlOrOptions.document ? urlOrOptions : { url: urlOrOptions, document: document, variables: variables, requestHeaders: requestHeaders, signal: undefined, }; } exports.parseRequestExtendedArgs = parseRequestExtendedArgs; function parseRawRequestExtendedArgs(urlOrOptions, query, variables, requestHeaders) { return urlOrOptions.query ? urlOrOptions : { url: urlOrOptions, query: query, variables: variables, requestHeaders: requestHeaders, signal: undefined, }; } exports.parseRawRequestExtendedArgs = parseRawRequestExtendedArgs; function parseBatchRequestsExtendedArgs(urlOrOptions, documents, requestHeaders) { return urlOrOptions.documents ? urlOrOptions : { url: urlOrOptions, documents: documents, requestHeaders: requestHeaders, signal: undefined, }; } exports.parseBatchRequestsExtendedArgs = parseBatchRequestsExtendedArgs; //# sourceMappingURL=parseArgs.js.map /***/ }), /***/ 8308: /***/ (function(__unused_webpack_module, exports) { "use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", ({ value: true })); exports.ClientError = void 0; var ClientError = /** @class */ (function (_super) { __extends(ClientError, _super); function ClientError(response, request) { var _this = this; var message = ClientError.extractMessage(response) + ": " + JSON.stringify({ response: response, request: request, }); _this = _super.call(this, message) || this; Object.setPrototypeOf(_this, ClientError.prototype); _this.response = response; _this.request = request; // this is needed as Safari doesn't support .captureStackTrace if (typeof Error.captureStackTrace === 'function') { Error.captureStackTrace(_this, ClientError); } return _this; } ClientError.extractMessage = function (response) { try { return response.errors[0].message; } catch (e) { return "GraphQL Error (Code: " + response.status + ")"; } }; return ClientError; }(Error)); exports.ClientError = ClientError; //# sourceMappingURL=types.js.map /***/ }), /***/ 33715: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { var hash = exports; hash.utils = __webpack_require__(26436); hash.common = __webpack_require__(95772); hash.sha = __webpack_require__(89041); hash.ripemd = __webpack_require__(12949); hash.hmac = __webpack_require__(52344); // Proxy hash functions to the main object hash.sha1 = hash.sha.sha1; hash.sha256 = hash.sha.sha256; hash.sha224 = hash.sha.sha224; hash.sha384 = hash.sha.sha384; hash.sha512 = hash.sha.sha512; hash.ripemd160 = hash.ripemd.ripemd160; /***/ }), /***/ 95772: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(26436); var assert = __webpack_require__(79746); function BlockHash() { this.pending = null; this.pendingTotal = 0; this.blockSize = this.constructor.blockSize; this.outSize = this.constructor.outSize; this.hmacStrength = this.constructor.hmacStrength; this.padLength = this.constructor.padLength / 8; this.endian = 'big'; this._delta8 = this.blockSize / 8; this._delta32 = this.blockSize / 32; } exports.BlockHash = BlockHash; BlockHash.prototype.update = function update(msg, enc) { // Convert message to array, pad it, and join into 32bit blocks msg = utils.toArray(msg, enc); if (!this.pending) this.pending = msg; else this.pending = this.pending.concat(msg); this.pendingTotal += msg.length; // Enough data, try updating if (this.pending.length >= this._delta8) { msg = this.pending; // Process pending data in blocks var r = msg.length % this._delta8; this.pending = msg.slice(msg.length - r, msg.length); if (this.pending.length === 0) this.pending = null; msg = utils.join32(msg, 0, msg.length - r, this.endian); for (var i = 0; i < msg.length; i += this._delta32) this._update(msg, i, i + this._delta32); } return this; }; BlockHash.prototype.digest = function digest(enc) { this.update(this._pad()); assert(this.pending === null); return this._digest(enc); }; BlockHash.prototype._pad = function pad() { var len = this.pendingTotal; var bytes = this._delta8; var k = bytes - ((len + this.padLength) % bytes); var res = new Array(k + this.padLength); res[0] = 0x80; for (var i = 1; i < k; i++) res[i] = 0; // Append length len <<= 3; if (this.endian === 'big') { for (var t = 8; t < this.padLength; t++) res[i++] = 0; res[i++] = 0; res[i++] = 0; res[i++] = 0; res[i++] = 0; res[i++] = (len >>> 24) & 0xff; res[i++] = (len >>> 16) & 0xff; res[i++] = (len >>> 8) & 0xff; res[i++] = len & 0xff; } else { res[i++] = len & 0xff; res[i++] = (len >>> 8) & 0xff; res[i++] = (len >>> 16) & 0xff; res[i++] = (len >>> 24) & 0xff; res[i++] = 0; res[i++] = 0; res[i++] = 0; res[i++] = 0; for (t = 8; t < this.padLength; t++) res[i++] = 0; } return res; }; /***/ }), /***/ 52344: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(26436); var assert = __webpack_require__(79746); function Hmac(hash, key, enc) { if (!(this instanceof Hmac)) return new Hmac(hash, key, enc); this.Hash = hash; this.blockSize = hash.blockSize / 8; this.outSize = hash.outSize / 8; this.inner = null; this.outer = null; this._init(utils.toArray(key, enc)); } module.exports = Hmac; Hmac.prototype._init = function init(key) { // Shorten key, if needed if (key.length > this.blockSize) key = new this.Hash().update(key).digest(); assert(key.length <= this.blockSize); // Add padding to key for (var i = key.length; i < this.blockSize; i++) key.push(0); for (i = 0; i < key.length; i++) key[i] ^= 0x36; this.inner = new this.Hash().update(key); // 0x36 ^ 0x5c = 0x6a for (i = 0; i < key.length; i++) key[i] ^= 0x6a; this.outer = new this.Hash().update(key); }; Hmac.prototype.update = function update(msg, enc) { this.inner.update(msg, enc); return this; }; Hmac.prototype.digest = function digest(enc) { this.outer.update(this.inner.digest()); return this.outer.digest(enc); }; /***/ }), /***/ 12949: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(26436); var common = __webpack_require__(95772); var rotl32 = utils.rotl32; var sum32 = utils.sum32; var sum32_3 = utils.sum32_3; var sum32_4 = utils.sum32_4; var BlockHash = common.BlockHash; function RIPEMD160() { if (!(this instanceof RIPEMD160)) return new RIPEMD160(); BlockHash.call(this); this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 ]; this.endian = 'little'; } utils.inherits(RIPEMD160, BlockHash); exports.ripemd160 = RIPEMD160; RIPEMD160.blockSize = 512; RIPEMD160.outSize = 160; RIPEMD160.hmacStrength = 192; RIPEMD160.padLength = 64; RIPEMD160.prototype._update = function update(msg, start) { var A = this.h[0]; var B = this.h[1]; var C = this.h[2]; var D = this.h[3]; var E = this.h[4]; var Ah = A; var Bh = B; var Ch = C; var Dh = D; var Eh = E; for (var j = 0; j < 80; j++) { var T = sum32( rotl32( sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)), s[j]), E); A = E; E = D; D = rotl32(C, 10); C = B; B = T; T = sum32( rotl32( sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)), sh[j]), Eh); Ah = Eh; Eh = Dh; Dh = rotl32(Ch, 10); Ch = Bh; Bh = T; } T = sum32_3(this.h[1], C, Dh); this.h[1] = sum32_3(this.h[2], D, Eh); this.h[2] = sum32_3(this.h[3], E, Ah); this.h[3] = sum32_3(this.h[4], A, Bh); this.h[4] = sum32_3(this.h[0], B, Ch); this.h[0] = T; }; RIPEMD160.prototype._digest = function digest(enc) { if (enc === 'hex') return utils.toHex32(this.h, 'little'); else return utils.split32(this.h, 'little'); }; function f(j, x, y, z) { if (j <= 15) return x ^ y ^ z; else if (j <= 31) return (x & y) | ((~x) & z); else if (j <= 47) return (x | (~y)) ^ z; else if (j <= 63) return (x & z) | (y & (~z)); else return x ^ (y | (~z)); } function K(j) { if (j <= 15) return 0x00000000; else if (j <= 31) return 0x5a827999; else if (j <= 47) return 0x6ed9eba1; else if (j <= 63) return 0x8f1bbcdc; else return 0xa953fd4e; } function Kh(j) { if (j <= 15) return 0x50a28be6; else if (j <= 31) return 0x5c4dd124; else if (j <= 47) return 0x6d703ef3; else if (j <= 63) return 0x7a6d76e9; else return 0x00000000; } var r = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13 ]; var rh = [ 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 ]; var s = [ 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 ]; var sh = [ 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 ]; /***/ }), /***/ 89041: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; exports.sha1 = __webpack_require__(84761); exports.sha224 = __webpack_require__(10799); exports.sha256 = __webpack_require__(89344); exports.sha384 = __webpack_require__(80772); exports.sha512 = __webpack_require__(45900); /***/ }), /***/ 84761: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(26436); var common = __webpack_require__(95772); var shaCommon = __webpack_require__(37038); var rotl32 = utils.rotl32; var sum32 = utils.sum32; var sum32_5 = utils.sum32_5; var ft_1 = shaCommon.ft_1; var BlockHash = common.BlockHash; var sha1_K = [ 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xCA62C1D6 ]; function SHA1() { if (!(this instanceof SHA1)) return new SHA1(); BlockHash.call(this); this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 ]; this.W = new Array(80); } utils.inherits(SHA1, BlockHash); module.exports = SHA1; SHA1.blockSize = 512; SHA1.outSize = 160; SHA1.hmacStrength = 80; SHA1.padLength = 64; SHA1.prototype._update = function _update(msg, start) { var W = this.W; for (var i = 0; i < 16; i++) W[i] = msg[start + i]; for(; i < W.length; i++) W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1); var a = this.h[0]; var b = this.h[1]; var c = this.h[2]; var d = this.h[3]; var e = this.h[4]; for (i = 0; i < W.length; i++) { var s = ~~(i / 20); var t = sum32_5(rotl32(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]); e = d; d = c; c = rotl32(b, 30); b = a; a = t; } this.h[0] = sum32(this.h[0], a); this.h[1] = sum32(this.h[1], b); this.h[2] = sum32(this.h[2], c); this.h[3] = sum32(this.h[3], d); this.h[4] = sum32(this.h[4], e); }; SHA1.prototype._digest = function digest(enc) { if (enc === 'hex') return utils.toHex32(this.h, 'big'); else return utils.split32(this.h, 'big'); }; /***/ }), /***/ 10799: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(26436); var SHA256 = __webpack_require__(89344); function SHA224() { if (!(this instanceof SHA224)) return new SHA224(); SHA256.call(this); this.h = [ 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 ]; } utils.inherits(SHA224, SHA256); module.exports = SHA224; SHA224.blockSize = 512; SHA224.outSize = 224; SHA224.hmacStrength = 192; SHA224.padLength = 64; SHA224.prototype._digest = function digest(enc) { // Just truncate output if (enc === 'hex') return utils.toHex32(this.h.slice(0, 7), 'big'); else return utils.split32(this.h.slice(0, 7), 'big'); }; /***/ }), /***/ 89344: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(26436); var common = __webpack_require__(95772); var shaCommon = __webpack_require__(37038); var assert = __webpack_require__(79746); var sum32 = utils.sum32; var sum32_4 = utils.sum32_4; var sum32_5 = utils.sum32_5; var ch32 = shaCommon.ch32; var maj32 = shaCommon.maj32; var s0_256 = shaCommon.s0_256; var s1_256 = shaCommon.s1_256; var g0_256 = shaCommon.g0_256; var g1_256 = shaCommon.g1_256; var BlockHash = common.BlockHash; var sha256_K = [ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 ]; function SHA256() { if (!(this instanceof SHA256)) return new SHA256(); BlockHash.call(this); this.h = [ 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 ]; this.k = sha256_K; this.W = new Array(64); } utils.inherits(SHA256, BlockHash); module.exports = SHA256; SHA256.blockSize = 512; SHA256.outSize = 256; SHA256.hmacStrength = 192; SHA256.padLength = 64; SHA256.prototype._update = function _update(msg, start) { var W = this.W; for (var i = 0; i < 16; i++) W[i] = msg[start + i]; for (; i < W.length; i++) W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]); var a = this.h[0]; var b = this.h[1]; var c = this.h[2]; var d = this.h[3]; var e = this.h[4]; var f = this.h[5]; var g = this.h[6]; var h = this.h[7]; assert(this.k.length === W.length); for (i = 0; i < W.length; i++) { var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]); var T2 = sum32(s0_256(a), maj32(a, b, c)); h = g; g = f; f = e; e = sum32(d, T1); d = c; c = b; b = a; a = sum32(T1, T2); } this.h[0] = sum32(this.h[0], a); this.h[1] = sum32(this.h[1], b); this.h[2] = sum32(this.h[2], c); this.h[3] = sum32(this.h[3], d); this.h[4] = sum32(this.h[4], e); this.h[5] = sum32(this.h[5], f); this.h[6] = sum32(this.h[6], g); this.h[7] = sum32(this.h[7], h); }; SHA256.prototype._digest = function digest(enc) { if (enc === 'hex') return utils.toHex32(this.h, 'big'); else return utils.split32(this.h, 'big'); }; /***/ }), /***/ 80772: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(26436); var SHA512 = __webpack_require__(45900); function SHA384() { if (!(this instanceof SHA384)) return new SHA384(); SHA512.call(this); this.h = [ 0xcbbb9d5d, 0xc1059ed8, 0x629a292a, 0x367cd507, 0x9159015a, 0x3070dd17, 0x152fecd8, 0xf70e5939, 0x67332667, 0xffc00b31, 0x8eb44a87, 0x68581511, 0xdb0c2e0d, 0x64f98fa7, 0x47b5481d, 0xbefa4fa4 ]; } utils.inherits(SHA384, SHA512); module.exports = SHA384; SHA384.blockSize = 1024; SHA384.outSize = 384; SHA384.hmacStrength = 192; SHA384.padLength = 128; SHA384.prototype._digest = function digest(enc) { if (enc === 'hex') return utils.toHex32(this.h.slice(0, 12), 'big'); else return utils.split32(this.h.slice(0, 12), 'big'); }; /***/ }), /***/ 45900: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(26436); var common = __webpack_require__(95772); var assert = __webpack_require__(79746); var rotr64_hi = utils.rotr64_hi; var rotr64_lo = utils.rotr64_lo; var shr64_hi = utils.shr64_hi; var shr64_lo = utils.shr64_lo; var sum64 = utils.sum64; var sum64_hi = utils.sum64_hi; var sum64_lo = utils.sum64_lo; var sum64_4_hi = utils.sum64_4_hi; var sum64_4_lo = utils.sum64_4_lo; var sum64_5_hi = utils.sum64_5_hi; var sum64_5_lo = utils.sum64_5_lo; var BlockHash = common.BlockHash; var sha512_K = [ 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd, 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc, 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019, 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118, 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe, 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2, 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1, 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694, 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3, 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65, 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483, 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5, 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210, 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4, 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725, 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70, 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926, 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df, 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8, 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b, 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001, 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30, 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910, 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8, 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53, 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8, 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb, 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3, 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60, 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec, 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9, 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b, 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207, 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178, 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6, 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b, 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493, 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c, 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a, 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817 ]; function SHA512() { if (!(this instanceof SHA512)) return new SHA512(); BlockHash.call(this); this.h = [ 0x6a09e667, 0xf3bcc908, 0xbb67ae85, 0x84caa73b, 0x3c6ef372, 0xfe94f82b, 0xa54ff53a, 0x5f1d36f1, 0x510e527f, 0xade682d1, 0x9b05688c, 0x2b3e6c1f, 0x1f83d9ab, 0xfb41bd6b, 0x5be0cd19, 0x137e2179 ]; this.k = sha512_K; this.W = new Array(160); } utils.inherits(SHA512, BlockHash); module.exports = SHA512; SHA512.blockSize = 1024; SHA512.outSize = 512; SHA512.hmacStrength = 192; SHA512.padLength = 128; SHA512.prototype._prepareBlock = function _prepareBlock(msg, start) { var W = this.W; // 32 x 32bit words for (var i = 0; i < 32; i++) W[i] = msg[start + i]; for (; i < W.length; i += 2) { var c0_hi = g1_512_hi(W[i - 4], W[i - 3]); // i - 2 var c0_lo = g1_512_lo(W[i - 4], W[i - 3]); var c1_hi = W[i - 14]; // i - 7 var c1_lo = W[i - 13]; var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); // i - 15 var c2_lo = g0_512_lo(W[i - 30], W[i - 29]); var c3_hi = W[i - 32]; // i - 16 var c3_lo = W[i - 31]; W[i] = sum64_4_hi( c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo); W[i + 1] = sum64_4_lo( c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo); } }; SHA512.prototype._update = function _update(msg, start) { this._prepareBlock(msg, start); var W = this.W; var ah = this.h[0]; var al = this.h[1]; var bh = this.h[2]; var bl = this.h[3]; var ch = this.h[4]; var cl = this.h[5]; var dh = this.h[6]; var dl = this.h[7]; var eh = this.h[8]; var el = this.h[9]; var fh = this.h[10]; var fl = this.h[11]; var gh = this.h[12]; var gl = this.h[13]; var hh = this.h[14]; var hl = this.h[15]; assert(this.k.length === W.length); for (var i = 0; i < W.length; i += 2) { var c0_hi = hh; var c0_lo = hl; var c1_hi = s1_512_hi(eh, el); var c1_lo = s1_512_lo(eh, el); var c2_hi = ch64_hi(eh, el, fh, fl, gh, gl); var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl); var c3_hi = this.k[i]; var c3_lo = this.k[i + 1]; var c4_hi = W[i]; var c4_lo = W[i + 1]; var T1_hi = sum64_5_hi( c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo, c4_hi, c4_lo); var T1_lo = sum64_5_lo( c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo, c4_hi, c4_lo); c0_hi = s0_512_hi(ah, al); c0_lo = s0_512_lo(ah, al); c1_hi = maj64_hi(ah, al, bh, bl, ch, cl); c1_lo = maj64_lo(ah, al, bh, bl, ch, cl); var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo); var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo); hh = gh; hl = gl; gh = fh; gl = fl; fh = eh; fl = el; eh = sum64_hi(dh, dl, T1_hi, T1_lo); el = sum64_lo(dl, dl, T1_hi, T1_lo); dh = ch; dl = cl; ch = bh; cl = bl; bh = ah; bl = al; ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo); al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo); } sum64(this.h, 0, ah, al); sum64(this.h, 2, bh, bl); sum64(this.h, 4, ch, cl); sum64(this.h, 6, dh, dl); sum64(this.h, 8, eh, el); sum64(this.h, 10, fh, fl); sum64(this.h, 12, gh, gl); sum64(this.h, 14, hh, hl); }; SHA512.prototype._digest = function digest(enc) { if (enc === 'hex') return utils.toHex32(this.h, 'big'); else return utils.split32(this.h, 'big'); }; function ch64_hi(xh, xl, yh, yl, zh) { var r = (xh & yh) ^ ((~xh) & zh); if (r < 0) r += 0x100000000; return r; } function ch64_lo(xh, xl, yh, yl, zh, zl) { var r = (xl & yl) ^ ((~xl) & zl); if (r < 0) r += 0x100000000; return r; } function maj64_hi(xh, xl, yh, yl, zh) { var r = (xh & yh) ^ (xh & zh) ^ (yh & zh); if (r < 0) r += 0x100000000; return r; } function maj64_lo(xh, xl, yh, yl, zh, zl) { var r = (xl & yl) ^ (xl & zl) ^ (yl & zl); if (r < 0) r += 0x100000000; return r; } function s0_512_hi(xh, xl) { var c0_hi = rotr64_hi(xh, xl, 28); var c1_hi = rotr64_hi(xl, xh, 2); // 34 var c2_hi = rotr64_hi(xl, xh, 7); // 39 var r = c0_hi ^ c1_hi ^ c2_hi; if (r < 0) r += 0x100000000; return r; } function s0_512_lo(xh, xl) { var c0_lo = rotr64_lo(xh, xl, 28); var c1_lo = rotr64_lo(xl, xh, 2); // 34 var c2_lo = rotr64_lo(xl, xh, 7); // 39 var r = c0_lo ^ c1_lo ^ c2_lo; if (r < 0) r += 0x100000000; return r; } function s1_512_hi(xh, xl) { var c0_hi = rotr64_hi(xh, xl, 14); var c1_hi = rotr64_hi(xh, xl, 18); var c2_hi = rotr64_hi(xl, xh, 9); // 41 var r = c0_hi ^ c1_hi ^ c2_hi; if (r < 0) r += 0x100000000; return r; } function s1_512_lo(xh, xl) { var c0_lo = rotr64_lo(xh, xl, 14); var c1_lo = rotr64_lo(xh, xl, 18); var c2_lo = rotr64_lo(xl, xh, 9); // 41 var r = c0_lo ^ c1_lo ^ c2_lo; if (r < 0) r += 0x100000000; return r; } function g0_512_hi(xh, xl) { var c0_hi = rotr64_hi(xh, xl, 1); var c1_hi = rotr64_hi(xh, xl, 8); var c2_hi = shr64_hi(xh, xl, 7); var r = c0_hi ^ c1_hi ^ c2_hi; if (r < 0) r += 0x100000000; return r; } function g0_512_lo(xh, xl) { var c0_lo = rotr64_lo(xh, xl, 1); var c1_lo = rotr64_lo(xh, xl, 8); var c2_lo = shr64_lo(xh, xl, 7); var r = c0_lo ^ c1_lo ^ c2_lo; if (r < 0) r += 0x100000000; return r; } function g1_512_hi(xh, xl) { var c0_hi = rotr64_hi(xh, xl, 19); var c1_hi = rotr64_hi(xl, xh, 29); // 61 var c2_hi = shr64_hi(xh, xl, 6); var r = c0_hi ^ c1_hi ^ c2_hi; if (r < 0) r += 0x100000000; return r; } function g1_512_lo(xh, xl) { var c0_lo = rotr64_lo(xh, xl, 19); var c1_lo = rotr64_lo(xl, xh, 29); // 61 var c2_lo = shr64_lo(xh, xl, 6); var r = c0_lo ^ c1_lo ^ c2_lo; if (r < 0) r += 0x100000000; return r; } /***/ }), /***/ 37038: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(26436); var rotr32 = utils.rotr32; function ft_1(s, x, y, z) { if (s === 0) return ch32(x, y, z); if (s === 1 || s === 3) return p32(x, y, z); if (s === 2) return maj32(x, y, z); } exports.ft_1 = ft_1; function ch32(x, y, z) { return (x & y) ^ ((~x) & z); } exports.ch32 = ch32; function maj32(x, y, z) { return (x & y) ^ (x & z) ^ (y & z); } exports.maj32 = maj32; function p32(x, y, z) { return x ^ y ^ z; } exports.p32 = p32; function s0_256(x) { return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22); } exports.s0_256 = s0_256; function s1_256(x) { return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25); } exports.s1_256 = s1_256; function g0_256(x) { return rotr32(x, 7) ^ rotr32(x, 18) ^ (x >>> 3); } exports.g0_256 = g0_256; function g1_256(x) { return rotr32(x, 17) ^ rotr32(x, 19) ^ (x >>> 10); } exports.g1_256 = g1_256; /***/ }), /***/ 26436: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; var assert = __webpack_require__(79746); var inherits = __webpack_require__(35717); exports.inherits = inherits; function isSurrogatePair(msg, i) { if ((msg.charCodeAt(i) & 0xFC00) !== 0xD800) { return false; } if (i < 0 || i + 1 >= msg.length) { return false; } return (msg.charCodeAt(i + 1) & 0xFC00) === 0xDC00; } function toArray(msg, enc) { if (Array.isArray(msg)) return msg.slice(); if (!msg) return []; var res = []; if (typeof msg === 'string') { if (!enc) { // Inspired by stringToUtf8ByteArray() in closure-library by Google // https://github.com/google/closure-library/blob/8598d87242af59aac233270742c8984e2b2bdbe0/closure/goog/crypt/crypt.js#L117-L143 // Apache License 2.0 // https://github.com/google/closure-library/blob/master/LICENSE var p = 0; for (var i = 0; i < msg.length; i++) { var c = msg.charCodeAt(i); if (c < 128) { res[p++] = c; } else if (c < 2048) { res[p++] = (c >> 6) | 192; res[p++] = (c & 63) | 128; } else if (isSurrogatePair(msg, i)) { c = 0x10000 + ((c & 0x03FF) << 10) + (msg.charCodeAt(++i) & 0x03FF); res[p++] = (c >> 18) | 240; res[p++] = ((c >> 12) & 63) | 128; res[p++] = ((c >> 6) & 63) | 128; res[p++] = (c & 63) | 128; } else { res[p++] = (c >> 12) | 224; res[p++] = ((c >> 6) & 63) | 128; res[p++] = (c & 63) | 128; } } } else if (enc === 'hex') { msg = msg.replace(/[^a-z0-9]+/ig, ''); if (msg.length % 2 !== 0) msg = '0' + msg; for (i = 0; i < msg.length; i += 2) res.push(parseInt(msg[i] + msg[i + 1], 16)); } } else { for (i = 0; i < msg.length; i++) res[i] = msg[i] | 0; } return res; } exports.toArray = toArray; function toHex(msg) { var res = ''; for (var i = 0; i < msg.length; i++) res += zero2(msg[i].toString(16)); return res; } exports.toHex = toHex; function htonl(w) { var res = (w >>> 24) | ((w >>> 8) & 0xff00) | ((w << 8) & 0xff0000) | ((w & 0xff) << 24); return res >>> 0; } exports.htonl = htonl; function toHex32(msg, endian) { var res = ''; for (var i = 0; i < msg.length; i++) { var w = msg[i]; if (endian === 'little') w = htonl(w); res += zero8(w.toString(16)); } return res; } exports.toHex32 = toHex32; function zero2(word) { if (word.length === 1) return '0' + word; else return word; } exports.zero2 = zero2; function zero8(word) { if (word.length === 7) return '0' + word; else if (word.length === 6) return '00' + word; else if (word.length === 5) return '000' + word; else if (word.length === 4) return '0000' + word; else if (word.length === 3) return '00000' + word; else if (word.length === 2) return '000000' + word; else if (word.length === 1) return '0000000' + word; else return word; } exports.zero8 = zero8; function join32(msg, start, end, endian) { var len = end - start; assert(len % 4 === 0); var res = new Array(len / 4); for (var i = 0, k = start; i < res.length; i++, k += 4) { var w; if (endian === 'big') w = (msg[k] << 24) | (msg[k + 1] << 16) | (msg[k + 2] << 8) | msg[k + 3]; else w = (msg[k + 3] << 24) | (msg[k + 2] << 16) | (msg[k + 1] << 8) | msg[k]; res[i] = w >>> 0; } return res; } exports.join32 = join32; function split32(msg, endian) { var res = new Array(msg.length * 4); for (var i = 0, k = 0; i < msg.length; i++, k += 4) { var m = msg[i]; if (endian === 'big') { res[k] = m >>> 24; res[k + 1] = (m >>> 16) & 0xff; res[k + 2] = (m >>> 8) & 0xff; res[k + 3] = m & 0xff; } else { res[k + 3] = m >>> 24; res[k + 2] = (m >>> 16) & 0xff; res[k + 1] = (m >>> 8) & 0xff; res[k] = m & 0xff; } } return res; } exports.split32 = split32; function rotr32(w, b) { return (w >>> b) | (w << (32 - b)); } exports.rotr32 = rotr32; function rotl32(w, b) { return (w << b) | (w >>> (32 - b)); } exports.rotl32 = rotl32; function sum32(a, b) { return (a + b) >>> 0; } exports.sum32 = sum32; function sum32_3(a, b, c) { return (a + b + c) >>> 0; } exports.sum32_3 = sum32_3; function sum32_4(a, b, c, d) { return (a + b + c + d) >>> 0; } exports.sum32_4 = sum32_4; function sum32_5(a, b, c, d, e) { return (a + b + c + d + e) >>> 0; } exports.sum32_5 = sum32_5; function sum64(buf, pos, ah, al) { var bh = buf[pos]; var bl = buf[pos + 1]; var lo = (al + bl) >>> 0; var hi = (lo < al ? 1 : 0) + ah + bh; buf[pos] = hi >>> 0; buf[pos + 1] = lo; } exports.sum64 = sum64; function sum64_hi(ah, al, bh, bl) { var lo = (al + bl) >>> 0; var hi = (lo < al ? 1 : 0) + ah + bh; return hi >>> 0; } exports.sum64_hi = sum64_hi; function sum64_lo(ah, al, bh, bl) { var lo = al + bl; return lo >>> 0; } exports.sum64_lo = sum64_lo; function sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) { var carry = 0; var lo = al; lo = (lo + bl) >>> 0; carry += lo < al ? 1 : 0; lo = (lo + cl) >>> 0; carry += lo < cl ? 1 : 0; lo = (lo + dl) >>> 0; carry += lo < dl ? 1 : 0; var hi = ah + bh + ch + dh + carry; return hi >>> 0; } exports.sum64_4_hi = sum64_4_hi; function sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) { var lo = al + bl + cl + dl; return lo >>> 0; } exports.sum64_4_lo = sum64_4_lo; function sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) { var carry = 0; var lo = al; lo = (lo + bl) >>> 0; carry += lo < al ? 1 : 0; lo = (lo + cl) >>> 0; carry += lo < cl ? 1 : 0; lo = (lo + dl) >>> 0; carry += lo < dl ? 1 : 0; lo = (lo + el) >>> 0; carry += lo < el ? 1 : 0; var hi = ah + bh + ch + dh + eh + carry; return hi >>> 0; } exports.sum64_5_hi = sum64_5_hi; function sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) { var lo = al + bl + cl + dl + el; return lo >>> 0; } exports.sum64_5_lo = sum64_5_lo; function rotr64_hi(ah, al, num) { var r = (al << (32 - num)) | (ah >>> num); return r >>> 0; } exports.rotr64_hi = rotr64_hi; function rotr64_lo(ah, al, num) { var r = (ah << (32 - num)) | (al >>> num); return r >>> 0; } exports.rotr64_lo = rotr64_lo; function shr64_hi(ah, al, num) { return ah >>> num; } exports.shr64_hi = shr64_hi; function shr64_lo(ah, al, num) { var r = (ah << (32 - num)) | (al >>> num); return r >>> 0; } exports.shr64_lo = shr64_lo; /***/ }), /***/ 24394: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "K": function() { return /* binding */ warning; }, /* harmony export */ "k": function() { return /* binding */ invariant; } /* harmony export */ }); var warning = function () { }; var invariant = function () { }; if (false) {} /***/ }), /***/ 8679: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var reactIs = __webpack_require__(59864); /** * Copyright 2015, Yahoo! Inc. * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. */ var REACT_STATICS = { childContextTypes: true, contextType: true, contextTypes: true, defaultProps: true, displayName: true, getDefaultProps: true, getDerivedStateFromError: true, getDerivedStateFromProps: true, mixins: true, propTypes: true, type: true }; var KNOWN_STATICS = { name: true, length: true, prototype: true, caller: true, callee: true, arguments: true, arity: true }; var FORWARD_REF_STATICS = { '$$typeof': true, render: true, defaultProps: true, displayName: true, propTypes: true }; var MEMO_STATICS = { '$$typeof': true, compare: true, defaultProps: true, displayName: true, propTypes: true, type: true }; var TYPE_STATICS = {}; TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS; TYPE_STATICS[reactIs.Memo] = MEMO_STATICS; function getStatics(component) { // React v16.11 and below if (reactIs.isMemo(component)) { return MEMO_STATICS; } // React v16.12 and above return TYPE_STATICS[component['$$typeof']] || REACT_STATICS; } var defineProperty = Object.defineProperty; var getOwnPropertyNames = Object.getOwnPropertyNames; var getOwnPropertySymbols = Object.getOwnPropertySymbols; var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; var getPrototypeOf = Object.getPrototypeOf; var objectPrototype = Object.prototype; function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) { if (typeof sourceComponent !== 'string') { // don't hoist over string (html) components if (objectPrototype) { var inheritedComponent = getPrototypeOf(sourceComponent); if (inheritedComponent && inheritedComponent !== objectPrototype) { hoistNonReactStatics(targetComponent, inheritedComponent, blacklist); } } var keys = getOwnPropertyNames(sourceComponent); if (getOwnPropertySymbols) { keys = keys.concat(getOwnPropertySymbols(sourceComponent)); } var targetStatics = getStatics(targetComponent); var sourceStatics = getStatics(sourceComponent); for (var i = 0; i < keys.length; ++i) { var key = keys[i]; if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) { var descriptor = getOwnPropertyDescriptor(sourceComponent, key); try { // Avoid failures from read-only properties defineProperty(targetComponent, key, descriptor); } catch (e) {} } } } return targetComponent; } module.exports = hoistNonReactStatics; /***/ }), /***/ 80645: /***/ (function(__unused_webpack_module, exports) { /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ exports.read = function (buffer, offset, isLE, mLen, nBytes) { var e, m var eLen = (nBytes * 8) - mLen - 1 var eMax = (1 << eLen) - 1 var eBias = eMax >> 1 var nBits = -7 var i = isLE ? (nBytes - 1) : 0 var d = isLE ? -1 : 1 var s = buffer[offset + i] i += d e = s & ((1 << (-nBits)) - 1) s >>= (-nBits) nBits += eLen for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {} m = e & ((1 << (-nBits)) - 1) e >>= (-nBits) nBits += mLen for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {} if (e === 0) { e = 1 - eBias } else if (e === eMax) { return m ? NaN : ((s ? -1 : 1) * Infinity) } else { m = m + Math.pow(2, mLen) e = e - eBias } return (s ? -1 : 1) * m * Math.pow(2, e - mLen) } exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { var e, m, c var eLen = (nBytes * 8) - mLen - 1 var eMax = (1 << eLen) - 1 var eBias = eMax >> 1 var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) var i = isLE ? 0 : (nBytes - 1) var d = isLE ? 1 : -1 var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 value = Math.abs(value) if (isNaN(value) || value === Infinity) { m = isNaN(value) ? 1 : 0 e = eMax } else { e = Math.floor(Math.log(value) / Math.LN2) if (value * (c = Math.pow(2, -e)) < 1) { e-- c *= 2 } if (e + eBias >= 1) { value += rt / c } else { value += rt * Math.pow(2, 1 - eBias) } if (value * c >= 2) { e++ c /= 2 } if (e + eBias >= eMax) { m = 0 e = eMax } else if (e + eBias >= 1) { m = ((value * c) - 1) * Math.pow(2, mLen) e = e + eBias } else { m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) e = 0 } } for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} e = (e << mLen) | m eLen += mLen for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} buffer[offset + i - d] |= s * 128 } /***/ }), /***/ 35717: /***/ (function(module) { if (typeof Object.create === 'function') { // implementation from standard node.js 'util' module module.exports = function inherits(ctor, superCtor) { if (superCtor) { ctor.super_ = superCtor ctor.prototype = Object.create(superCtor.prototype, { constructor: { value: ctor, enumerable: false, writable: true, configurable: true } }) } }; } else { // old school shim for old browsers module.exports = function inherits(ctor, superCtor) { if (superCtor) { ctor.super_ = superCtor var TempCtor = function () {} TempCtor.prototype = superCtor.prototype ctor.prototype = new TempCtor() ctor.prototype.constructor = ctor } } } /***/ }), /***/ 4501: /***/ (function(module) { module.exports = isTypedArray isTypedArray.strict = isStrictTypedArray isTypedArray.loose = isLooseTypedArray var toString = Object.prototype.toString var names = { '[object Int8Array]': true , '[object Int16Array]': true , '[object Int32Array]': true , '[object Uint8Array]': true , '[object Uint8ClampedArray]': true , '[object Uint16Array]': true , '[object Uint32Array]': true , '[object Float32Array]': true , '[object Float64Array]': true } function isTypedArray(arr) { return ( isStrictTypedArray(arr) || isLooseTypedArray(arr) ) } function isStrictTypedArray(arr) { return ( arr instanceof Int8Array || arr instanceof Int16Array || arr instanceof Int32Array || arr instanceof Uint8Array || arr instanceof Uint8ClampedArray || arr instanceof Uint16Array || arr instanceof Uint32Array || arr instanceof Float32Array || arr instanceof Float64Array ) } function isLooseTypedArray(arr) { return names[toString.call(arr)] } /***/ }), /***/ 91131: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Dv": function() { return /* binding */ useAtomValue; }, /* harmony export */ "KO": function() { return /* binding */ useAtom; }, /* harmony export */ "b9": function() { return /* binding */ useSetAtom; }, /* harmony export */ "cn": function() { return /* binding */ atom; } /* harmony export */ }); /* unused harmony exports Provider, SECRET_INTERNAL_getScopeContext, unstable_createStore */ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(67294); const SUSPENSE_PROMISE = Symbol(); const isSuspensePromise = (promise) => !!promise[SUSPENSE_PROMISE]; const isSuspensePromiseAlreadyCancelled = (suspensePromise) => !suspensePromise[SUSPENSE_PROMISE].c; const cancelSuspensePromise = (suspensePromise) => { var _a, _b; (_b = (_a = suspensePromise[SUSPENSE_PROMISE]).c) == null ? void 0 : _b.call(_a); }; const isEqualSuspensePromise = (oldSuspensePromise, newSuspensePromise) => { const oldOriginalPromise = oldSuspensePromise[SUSPENSE_PROMISE].o; const newOriginalPromise = newSuspensePromise[SUSPENSE_PROMISE].o; return oldOriginalPromise === newOriginalPromise || oldSuspensePromise === newOriginalPromise || isSuspensePromise(oldOriginalPromise) && isEqualSuspensePromise(oldOriginalPromise, newSuspensePromise); }; const createSuspensePromise = (promise) => { const objectToAttach = { o: promise, c: null }; const suspensePromise = new Promise((resolve) => { objectToAttach.c = () => { objectToAttach.c = null; resolve(); }; promise.then(objectToAttach.c, objectToAttach.c); }); suspensePromise[SUSPENSE_PROMISE] = objectToAttach; return suspensePromise; }; const hasInitialValue = (atom) => "init" in atom; const READ_ATOM = "r"; const WRITE_ATOM = "w"; const COMMIT_ATOM = "c"; const SUBSCRIBE_ATOM = "s"; const RESTORE_ATOMS = "h"; const DEV_SUBSCRIBE_STATE = "n"; const DEV_GET_MOUNTED_ATOMS = "l"; const DEV_GET_ATOM_STATE = "a"; const DEV_GET_MOUNTED = "m"; const createStore = (initialValues) => { const committedAtomStateMap = /* @__PURE__ */ new WeakMap(); const mountedMap = /* @__PURE__ */ new WeakMap(); const pendingMap = /* @__PURE__ */ new Map(); let stateListeners; let mountedAtoms; if (true) { stateListeners = /* @__PURE__ */ new Set(); mountedAtoms = /* @__PURE__ */ new Set(); } if (initialValues) { for (const [atom, value] of initialValues) { const atomState = { v: value, r: 0, y: true, d: /* @__PURE__ */ new Map() }; if (true) { Object.freeze(atomState); if (!hasInitialValue(atom)) { console.warn( "Found initial value for derived atom which can cause unexpected behavior", atom ); } } committedAtomStateMap.set(atom, atomState); } } const suspensePromiseCacheMap = /* @__PURE__ */ new WeakMap(); const addSuspensePromiseToCache = (version, atom, suspensePromise) => { let cache = suspensePromiseCacheMap.get(atom); if (!cache) { cache = /* @__PURE__ */ new Map(); suspensePromiseCacheMap.set(atom, cache); } suspensePromise.then(() => { if (cache.get(version) === suspensePromise) { cache.delete(version); if (!cache.size) { suspensePromiseCacheMap.delete(atom); } } }); cache.set(version, suspensePromise); }; const cancelAllSuspensePromiseInCache = (atom) => { const versionSet = /* @__PURE__ */ new Set(); const cache = suspensePromiseCacheMap.get(atom); if (cache) { suspensePromiseCacheMap.delete(atom); cache.forEach((suspensePromise, version) => { cancelSuspensePromise(suspensePromise); versionSet.add(version); }); } return versionSet; }; const versionedAtomStateMapMap = /* @__PURE__ */ new WeakMap(); const getVersionedAtomStateMap = (version) => { let versionedAtomStateMap = versionedAtomStateMapMap.get(version); if (!versionedAtomStateMap) { versionedAtomStateMap = /* @__PURE__ */ new Map(); versionedAtomStateMapMap.set(version, versionedAtomStateMap); } return versionedAtomStateMap; }; const getAtomState = (version, atom) => { if (version) { const versionedAtomStateMap = getVersionedAtomStateMap(version); let atomState = versionedAtomStateMap.get(atom); if (!atomState) { atomState = getAtomState(version.p, atom); if (atomState) { versionedAtomStateMap.set(atom, atomState); } } return atomState; } return committedAtomStateMap.get(atom); }; const setAtomState = (version, atom, atomState) => { if (true) { Object.freeze(atomState); } if (version) { const versionedAtomStateMap = getVersionedAtomStateMap(version); versionedAtomStateMap.set(atom, atomState); } else { const prevAtomState = committedAtomStateMap.get(atom); committedAtomStateMap.set(atom, atomState); if (!pendingMap.has(atom)) { pendingMap.set(atom, prevAtomState); } } }; const createReadDependencies = (version, prevReadDependencies = /* @__PURE__ */ new Map(), dependencies) => { if (!dependencies) { return prevReadDependencies; } const readDependencies = /* @__PURE__ */ new Map(); let changed = false; dependencies.forEach((atom) => { var _a; const revision = ((_a = getAtomState(version, atom)) == null ? void 0 : _a.r) || 0; readDependencies.set(atom, revision); if (prevReadDependencies.get(atom) !== revision) { changed = true; } }); if (prevReadDependencies.size === readDependencies.size && !changed) { return prevReadDependencies; } return readDependencies; }; const setAtomValue = (version, atom, value, dependencies, suspensePromise) => { const atomState = getAtomState(version, atom); if (atomState) { if (suspensePromise && (!("p" in atomState) || !isEqualSuspensePromise(atomState.p, suspensePromise))) { return atomState; } if ("p" in atomState) { cancelSuspensePromise(atomState.p); } } const nextAtomState = { v: value, r: (atomState == null ? void 0 : atomState.r) || 0, y: true, d: createReadDependencies(version, atomState == null ? void 0 : atomState.d, dependencies) }; let changed = !(atomState == null ? void 0 : atomState.y); if (!atomState || !("v" in atomState) || !Object.is(atomState.v, value)) { changed = true; ++nextAtomState.r; if (nextAtomState.d.has(atom)) { nextAtomState.d = new Map(nextAtomState.d).set(atom, nextAtomState.r); } } else if (nextAtomState.d !== atomState.d && (nextAtomState.d.size !== atomState.d.size || !Array.from(nextAtomState.d.keys()).every((a) => atomState.d.has(a)))) { changed = true; Promise.resolve().then(() => { flushPending(version); }); } if (atomState && !changed) { return atomState; } setAtomState(version, atom, nextAtomState); return nextAtomState; }; const setAtomReadError = (version, atom, error, dependencies, suspensePromise) => { const atomState = getAtomState(version, atom); if (atomState) { if (suspensePromise && (!("p" in atomState) || !isEqualSuspensePromise(atomState.p, suspensePromise))) { return atomState; } if ("p" in atomState) { cancelSuspensePromise(atomState.p); } } const nextAtomState = { e: error, r: ((atomState == null ? void 0 : atomState.r) || 0) + 1, y: true, d: createReadDependencies(version, atomState == null ? void 0 : atomState.d, dependencies) }; setAtomState(version, atom, nextAtomState); return nextAtomState; }; const setAtomSuspensePromise = (version, atom, suspensePromise, dependencies) => { const atomState = getAtomState(version, atom); if (atomState && "p" in atomState) { if (isEqualSuspensePromise(atomState.p, suspensePromise)) { if (!atomState.y) { return { ...atomState, y: true }; } return atomState; } cancelSuspensePromise(atomState.p); } addSuspensePromiseToCache(version, atom, suspensePromise); const nextAtomState = { p: suspensePromise, r: ((atomState == null ? void 0 : atomState.r) || 0) + 1, y: true, d: createReadDependencies(version, atomState == null ? void 0 : atomState.d, dependencies) }; setAtomState(version, atom, nextAtomState); return nextAtomState; }; const setAtomPromiseOrValue = (version, atom, promiseOrValue, dependencies) => { if (promiseOrValue instanceof Promise) { const suspensePromise = createSuspensePromise( promiseOrValue.then((value) => { setAtomValue(version, atom, value, dependencies, suspensePromise); }).catch((e) => { if (e instanceof Promise) { if (isSuspensePromise(e)) { return e.then(() => { readAtomState(version, atom, true); }); } return e; } setAtomReadError(version, atom, e, dependencies, suspensePromise); }) ); return setAtomSuspensePromise( version, atom, suspensePromise, dependencies ); } return setAtomValue( version, atom, promiseOrValue, dependencies ); }; const setAtomInvalidated = (version, atom) => { const atomState = getAtomState(version, atom); if (atomState) { const nextAtomState = { ...atomState, y: false }; setAtomState(version, atom, nextAtomState); } else if (true) { console.warn("[Bug] could not invalidate non existing atom", atom); } }; const readAtomState = (version, atom, force) => { if (!force) { const atomState = getAtomState(version, atom); if (atomState) { if (atomState.y && "p" in atomState && !isSuspensePromiseAlreadyCancelled(atomState.p)) { return atomState; } atomState.d.forEach((_, a) => { if (a !== atom) { if (!mountedMap.has(a)) { readAtomState(version, a); } else { const aState = getAtomState(version, a); if (aState && !aState.y) { readAtomState(version, a); } } } }); if (Array.from(atomState.d).every(([a, r]) => { const aState = getAtomState(version, a); return aState && !("p" in aState) && aState.r === r; })) { if (!atomState.y) { return { ...atomState, y: true }; } return atomState; } } } const dependencies = /* @__PURE__ */ new Set(); try { const promiseOrValue = atom.read((a) => { dependencies.add(a); const aState = a === atom ? getAtomState(version, a) : readAtomState(version, a); if (aState) { if ("e" in aState) { throw aState.e; } if ("p" in aState) { throw aState.p; } return aState.v; } if (hasInitialValue(a)) { return a.init; } throw new Error("no atom init"); }); return setAtomPromiseOrValue(version, atom, promiseOrValue, dependencies); } catch (errorOrPromise) { if (errorOrPromise instanceof Promise) { const suspensePromise = createSuspensePromise(errorOrPromise); return setAtomSuspensePromise( version, atom, suspensePromise, dependencies ); } return setAtomReadError(version, atom, errorOrPromise, dependencies); } }; const readAtom = (readingAtom, version) => { const atomState = readAtomState(version, readingAtom); return atomState; }; const addAtom = (version, addingAtom) => { let mounted = mountedMap.get(addingAtom); if (!mounted) { mounted = mountAtom(version, addingAtom); } return mounted; }; const canUnmountAtom = (atom, mounted) => !mounted.l.size && (!mounted.t.size || mounted.t.size === 1 && mounted.t.has(atom)); const delAtom = (version, deletingAtom) => { const mounted = mountedMap.get(deletingAtom); if (mounted && canUnmountAtom(deletingAtom, mounted)) { unmountAtom(version, deletingAtom); } }; const invalidateDependents = (version, atom) => { const mounted = mountedMap.get(atom); mounted == null ? void 0 : mounted.t.forEach((dependent) => { if (dependent !== atom) { setAtomInvalidated(version, dependent); invalidateDependents(version, dependent); } }); }; const writeAtomState = (version, atom, update) => { let isSync = true; const writeGetter = (a, options) => { const aState = readAtomState(version, a); if ("e" in aState) { throw aState.e; } if ("p" in aState) { if (options == null ? void 0 : options.unstable_promise) { return aState.p.then( () => writeGetter(a, options) ); } if (true) { console.info( "Reading pending atom state in write operation. We throw a promise for now.", a ); } throw aState.p; } if ("v" in aState) { return aState.v; } if (true) { console.warn( "[Bug] no value found while reading atom in write operation. This is probably a bug.", a ); } throw new Error("no value found"); }; const setter = (a, v) => { let promiseOrVoid2; if (a === atom) { if (!hasInitialValue(a)) { throw new Error("atom not writable"); } const versionSet = cancelAllSuspensePromiseInCache(a); versionSet.forEach((cancelledVersion) => { if (cancelledVersion !== version) { setAtomPromiseOrValue(cancelledVersion, a, v); } }); const prevAtomState = getAtomState(version, a); const nextAtomState = setAtomPromiseOrValue(version, a, v); if (prevAtomState !== nextAtomState) { invalidateDependents(version, a); } } else { promiseOrVoid2 = writeAtomState(version, a, v); } if (!isSync) { flushPending(version); } return promiseOrVoid2; }; const promiseOrVoid = atom.write(writeGetter, setter, update); isSync = false; return promiseOrVoid; }; const writeAtom = (writingAtom, update, version) => { const promiseOrVoid = writeAtomState(version, writingAtom, update); flushPending(version); return promiseOrVoid; }; const isActuallyWritableAtom = (atom) => !!atom.write; const mountAtom = (version, atom, initialDependent) => { const mounted = { t: new Set(initialDependent && [initialDependent]), l: /* @__PURE__ */ new Set() }; mountedMap.set(atom, mounted); if (true) { mountedAtoms.add(atom); } const atomState = readAtomState(void 0, atom); atomState.d.forEach((_, a) => { const aMounted = mountedMap.get(a); if (aMounted) { aMounted.t.add(atom); } else { if (a !== atom) { mountAtom(version, a, atom); } } }); if (isActuallyWritableAtom(atom) && atom.onMount) { const setAtom = (update) => writeAtom(atom, update, version); const onUnmount = atom.onMount(setAtom); version = void 0; if (onUnmount) { mounted.u = onUnmount; } } return mounted; }; const unmountAtom = (version, atom) => { var _a; const onUnmount = (_a = mountedMap.get(atom)) == null ? void 0 : _a.u; if (onUnmount) { onUnmount(); } mountedMap.delete(atom); if (true) { mountedAtoms.delete(atom); } const atomState = getAtomState(version, atom); if (atomState) { atomState.d.forEach((_, a) => { if (a !== atom) { const mounted = mountedMap.get(a); if (mounted) { mounted.t.delete(atom); if (canUnmountAtom(a, mounted)) { unmountAtom(version, a); } } } }); } else if (true) { console.warn("[Bug] could not find atom state to unmount", atom); } }; const mountDependencies = (version, atom, atomState, prevReadDependencies) => { const dependencies = new Set(atomState.d.keys()); prevReadDependencies == null ? void 0 : prevReadDependencies.forEach((_, a) => { if (dependencies.has(a)) { dependencies.delete(a); return; } const mounted = mountedMap.get(a); if (mounted) { mounted.t.delete(atom); if (canUnmountAtom(a, mounted)) { unmountAtom(version, a); } } }); dependencies.forEach((a) => { const mounted = mountedMap.get(a); if (mounted) { mounted.t.add(atom); } else if (mountedMap.has(atom)) { mountAtom(version, a, atom); } }); }; const flushPending = (version) => { if (version) { const versionedAtomStateMap = getVersionedAtomStateMap(version); versionedAtomStateMap.forEach((atomState, atom) => { const committedAtomState = committedAtomStateMap.get(atom); if (atomState !== committedAtomState) { const mounted = mountedMap.get(atom); mounted == null ? void 0 : mounted.l.forEach((listener) => listener(version)); } }); return; } while (pendingMap.size) { const pending = Array.from(pendingMap); pendingMap.clear(); pending.forEach(([atom, prevAtomState]) => { const atomState = getAtomState(void 0, atom); if (atomState && atomState.d !== (prevAtomState == null ? void 0 : prevAtomState.d)) { mountDependencies(void 0, atom, atomState, prevAtomState == null ? void 0 : prevAtomState.d); } if (prevAtomState && !prevAtomState.y && (atomState == null ? void 0 : atomState.y)) { return; } const mounted = mountedMap.get(atom); mounted == null ? void 0 : mounted.l.forEach((listener) => listener()); }); } if (true) { stateListeners.forEach((l) => l()); } }; const commitVersionedAtomStateMap = (version) => { const versionedAtomStateMap = getVersionedAtomStateMap(version); versionedAtomStateMap.forEach((atomState, atom) => { const prevAtomState = committedAtomStateMap.get(atom); if (!prevAtomState || atomState.r > prevAtomState.r || atomState.y !== prevAtomState.y || atomState.r === prevAtomState.r && atomState.d !== prevAtomState.d) { committedAtomStateMap.set(atom, atomState); if (atomState.d !== (prevAtomState == null ? void 0 : prevAtomState.d)) { mountDependencies(version, atom, atomState, prevAtomState == null ? void 0 : prevAtomState.d); } } }); }; const commitAtom = (_atom, version) => { if (version) { commitVersionedAtomStateMap(version); } flushPending(void 0); }; const subscribeAtom = (atom, callback, version) => { const mounted = addAtom(version, atom); const listeners = mounted.l; listeners.add(callback); return () => { listeners.delete(callback); delAtom(version, atom); }; }; const restoreAtoms = (values, version) => { for (const [atom, value] of values) { if (hasInitialValue(atom)) { setAtomPromiseOrValue(version, atom, value); invalidateDependents(version, atom); } } flushPending(version); }; if (true) { return { [READ_ATOM]: readAtom, [WRITE_ATOM]: writeAtom, [COMMIT_ATOM]: commitAtom, [SUBSCRIBE_ATOM]: subscribeAtom, [RESTORE_ATOMS]: restoreAtoms, [DEV_SUBSCRIBE_STATE]: (l) => { stateListeners.add(l); return () => { stateListeners.delete(l); }; }, [DEV_GET_MOUNTED_ATOMS]: () => mountedAtoms.values(), [DEV_GET_ATOM_STATE]: (a) => committedAtomStateMap.get(a), [DEV_GET_MOUNTED]: (a) => mountedMap.get(a) }; } return { [READ_ATOM]: readAtom, [WRITE_ATOM]: writeAtom, [COMMIT_ATOM]: commitAtom, [SUBSCRIBE_ATOM]: subscribeAtom, [RESTORE_ATOMS]: restoreAtoms }; }; const createStoreForExport = (initialValues) => { const store = createStore(initialValues); const get = (atom) => { const atomState = store[READ_ATOM](atom); if ("e" in atomState) { throw atomState.e; } if ("p" in atomState) { return void 0; } return atomState.v; }; const asyncGet = (atom) => new Promise((resolve, reject) => { const atomState = store[READ_ATOM](atom); if ("e" in atomState) { reject(atomState.e); } else if ("p" in atomState) { resolve(atomState.p.then(() => asyncGet(atom))); } else { resolve(atomState.v); } }); const set = (atom, update) => store[WRITE_ATOM](atom, update); const sub = (atom, callback) => store[SUBSCRIBE_ATOM](atom, callback); return { get, asyncGet, set, sub, SECRET_INTERNAL_store: store }; }; const createScopeContainer = (initialValues, unstable_createStore) => { const store = unstable_createStore ? unstable_createStore(initialValues).SECRET_INTERNAL_store : createStore(initialValues); return { s: store }; }; const ScopeContextMap = /* @__PURE__ */ new Map(); const getScopeContext = (scope) => { if (!ScopeContextMap.has(scope)) { ScopeContextMap.set(scope, (0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(createScopeContainer())); } return ScopeContextMap.get(scope); }; const Provider = ({ children, initialValues, scope, unstable_createStore, unstable_enableVersionedWrite }) => { const [version, setVersion] = useState({}); useEffect(() => { const scopeContainer = scopeContainerRef.current; if (scopeContainer.w) { scopeContainer.s[COMMIT_ATOM](null, version); delete version.p; scopeContainer.v = version; } }, [version]); const scopeContainerRef = useRef(); if (!scopeContainerRef.current) { const scopeContainer = createScopeContainer( initialValues, unstable_createStore ); if (unstable_enableVersionedWrite) { let retrying = 0; scopeContainer.w = (write) => { setVersion((parentVersion) => { const nextVersion = retrying ? parentVersion : { p: parentVersion }; write(nextVersion); return nextVersion; }); }; scopeContainer.v = version; scopeContainer.r = (fn) => { ++retrying; fn(); --retrying; }; } scopeContainerRef.current = scopeContainer; } const ScopeContainerContext = getScopeContext(scope); return createElement( ScopeContainerContext.Provider, { value: scopeContainerRef.current }, children ); }; let keyCount = 0; function atom(read, write) { const key = `atom${++keyCount}`; const config = { toString: () => key }; if (typeof read === "function") { config.read = read; } else { config.init = read; config.read = (get) => get(config); config.write = (get, set, update) => set(config, typeof update === "function" ? update(get(config)) : update); } if (write) { config.write = write; } return config; } function useAtomValue(atom, scope) { const ScopeContext = getScopeContext(scope); const scopeContainer = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(ScopeContext); const { s: store, v: versionFromProvider } = scopeContainer; const getAtomValue = (version2) => { const atomState = store[READ_ATOM](atom, version2); if ( true && !atomState.y) { throw new Error("should not be invalidated"); } if ("e" in atomState) { throw atomState.e; } if ("p" in atomState) { throw atomState.p; } if ("v" in atomState) { return atomState.v; } throw new Error("no atom value"); }; const [[version, valueFromReducer, atomFromReducer], rerenderIfChanged] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useReducer)( (prev, nextVersion) => { const nextValue = getAtomValue(nextVersion); if (Object.is(prev[1], nextValue) && prev[2] === atom) { return prev; } return [nextVersion, nextValue, atom]; }, versionFromProvider, (initialVersion) => { const initialValue = getAtomValue(initialVersion); return [initialVersion, initialValue, atom]; } ); let value = valueFromReducer; if (atomFromReducer !== atom) { rerenderIfChanged(version); value = getAtomValue(version); } (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { const { v: versionFromProvider2 } = scopeContainer; if (versionFromProvider2) { store[COMMIT_ATOM](atom, versionFromProvider2); } const unsubscribe = store[SUBSCRIBE_ATOM]( atom, rerenderIfChanged, versionFromProvider2 ); rerenderIfChanged(versionFromProvider2); return unsubscribe; }, [store, atom, scopeContainer]); (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { store[COMMIT_ATOM](atom, version); }); (0,react__WEBPACK_IMPORTED_MODULE_0__.useDebugValue)(value); return value; } function useSetAtom(atom, scope) { const ScopeContext = getScopeContext(scope); const { s: store, w: versionedWrite } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(ScopeContext); const setAtom = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)( (update) => { if ( true && !("write" in atom)) { throw new Error("not writable atom"); } const write = (version) => store[WRITE_ATOM](atom, update, version); return versionedWrite ? versionedWrite(write) : write(); }, [store, versionedWrite, atom] ); return setAtom; } function useAtom(atom, scope) { if ("scope" in atom) { console.warn( "atom.scope is deprecated. Please do useAtom(atom, scope) instead." ); scope = atom.scope; } return [ useAtomValue(atom, scope), useSetAtom(atom, scope) ]; } /***/ }), /***/ 64824: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "FL": function() { return /* binding */ createJSONStorage; }, /* harmony export */ "O4": function() { return /* binding */ atomWithStorage; }, /* harmony export */ "w4": function() { return /* binding */ useReducerAtom; } /* harmony export */ }); /* unused harmony exports RESET, atomFamily, atomWithDefault, atomWithHash, atomWithObservable, atomWithReducer, atomWithReset, freezeAtom, freezeAtomCreator, loadable, selectAtom, splitAtom, useAtomCallback, useHydrateAtoms, useResetAtom, waitForAll */ /* harmony import */ var jotai__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(91131); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(67294); const RESET = Symbol(); function atomWithReset(initialValue) { const anAtom = atom(initialValue, (get, set, update) => { if (update === RESET) { set(anAtom, initialValue); } else { set( anAtom, typeof update === "function" ? update(get(anAtom)) : update ); } }); return anAtom; } const WRITE_ATOM = "w"; const RESTORE_ATOMS = "h"; function useResetAtom(anAtom, scope) { const ScopeContext = SECRET_INTERNAL_getScopeContext(scope); const store = useContext(ScopeContext).s; const setAtom = useCallback( () => store[WRITE_ATOM](anAtom, RESET), [store, anAtom] ); return setAtom; } function useReducerAtom(anAtom, reducer, scope) { const [state, setState] = (0,jotai__WEBPACK_IMPORTED_MODULE_1__/* .useAtom */ .KO)(anAtom, scope); const dispatch = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)( (action) => { setState((prev) => reducer(prev, action)); }, [setState, reducer] ); return [state, dispatch]; } function atomWithReducer(initialValue, reducer) { const anAtom = atom( initialValue, (get, set, action) => set(anAtom, reducer(get(anAtom), action)) ); return anAtom; } function atomFamily(initializeAtom, areEqual) { let shouldRemove = null; const atoms = /* @__PURE__ */ new Map(); const createAtom = (param) => { let item; if (areEqual === void 0) { item = atoms.get(param); } else { for (const [key, value] of atoms) { if (areEqual(key, param)) { item = value; break; } } } if (item !== void 0) { if (shouldRemove == null ? void 0 : shouldRemove(item[1], param)) { atoms.delete(param); } else { return item[0]; } } const newAtom = initializeAtom(param); atoms.set(param, [newAtom, Date.now()]); return newAtom; }; createAtom.remove = (param) => { if (areEqual === void 0) { atoms.delete(param); } else { for (const [key] of atoms) { if (areEqual(key, param)) { atoms.delete(key); break; } } } }; createAtom.setShouldRemove = (fn) => { shouldRemove = fn; if (!shouldRemove) return; for (const [key, value] of atoms) { if (shouldRemove(value[1], key)) { atoms.delete(key); } } }; return createAtom; } const getWeakCacheItem = (cache, deps) => { do { const [dep, ...rest] = deps; const entry = cache.get(dep); if (!entry) { return; } if (!rest.length) { return entry[1]; } cache = entry[0]; deps = rest; } while (deps.length); }; const setWeakCacheItem = (cache, deps, item) => { do { const [dep, ...rest] = deps; let entry = cache.get(dep); if (!entry) { entry = [ new WeakMap()]; cache.set(dep, entry); } if (!rest.length) { entry[1] = item; return; } cache = entry[0]; deps = rest; } while (deps.length); }; const createMemoizeAtom = () => { const cache = /* @__PURE__ */ new WeakMap(); const memoizeAtom = (createAtom, deps) => { const cachedAtom = getWeakCacheItem(cache, deps); if (cachedAtom) { return cachedAtom; } const createdAtom = createAtom(); setWeakCacheItem(cache, deps, createdAtom); return createdAtom; }; return memoizeAtom; }; const memoizeAtom$4 = createMemoizeAtom(); function selectAtom(anAtom, selector, equalityFn = Object.is) { return memoizeAtom$4(() => { const refAtom = atom(() => ({})); const derivedAtom = atom((get) => { const slice = selector(get(anAtom)); const ref = get(refAtom); if ("prev" in ref && equalityFn(ref.prev, slice)) { return ref.prev; } ref.prev = slice; return slice; }); return derivedAtom; }, [anAtom, selector, equalityFn]); } function useAtomCallback(callback, scope) { const anAtom = useMemo( () => atom( null, (get, set, [arg, resolve, reject]) => { try { resolve(callback(get, set, arg)); } catch (e) { reject(e); } } ), [callback] ); const invoke = useSetAtom(anAtom, scope); return useCallback( (arg) => { let isSync = true; let settled = {}; const promise = new Promise((resolve, reject) => { invoke([ arg, (v) => { if (isSync) { settled = { v }; } else { resolve(v); } }, (e) => { if (isSync) { settled = { e }; } else { reject(e); } } ]); }); isSync = false; if ("e" in settled) { throw settled.e; } if ("v" in settled) { return settled.v; } return promise; }, [invoke] ); } const memoizeAtom$3 = createMemoizeAtom(); const deepFreeze = (obj) => { if (typeof obj !== "object" || obj === null) return; Object.freeze(obj); const propNames = Object.getOwnPropertyNames(obj); for (const name of propNames) { const value = obj[name]; deepFreeze(value); } return obj; }; function freezeAtom(anAtom) { return memoizeAtom$3(() => { const frozenAtom = atom( (get) => deepFreeze(get(anAtom)), (_get, set, arg) => set(anAtom, arg) ); return frozenAtom; }, [anAtom]); } function freezeAtomCreator(createAtom) { return (...params) => { const anAtom = createAtom(...params); const origRead = anAtom.read; anAtom.read = (get) => deepFreeze(origRead(get)); return anAtom; }; } const memoizeAtom$2 = createMemoizeAtom(); const isWritable = (atom2) => !!atom2.write; const isFunction = (x) => typeof x === "function"; function splitAtom(arrAtom, keyExtractor) { return memoizeAtom$2( () => { const mappingCache = /* @__PURE__ */ new WeakMap(); const getMapping = (arr, prev) => { let mapping = mappingCache.get(arr); if (mapping) { return mapping; } const prevMapping = prev && mappingCache.get(prev); const atomList = []; const keyList = []; arr.forEach((item, index) => { const key = keyExtractor ? keyExtractor(item) : index; keyList[index] = key; const cachedAtom = prevMapping && prevMapping.atomList[prevMapping.keyList.indexOf(key)]; if (cachedAtom) { atomList[index] = cachedAtom; return; } const read2 = (get) => { const ref = get(refAtom); const currArr = get(arrAtom); const mapping2 = getMapping(currArr, ref.prev); const index2 = mapping2.keyList.indexOf(key); if (index2 < 0 || index2 >= currArr.length) { const prevItem = arr[getMapping(arr).keyList.indexOf(key)]; if (prevItem) { return prevItem; } throw new Error("splitAtom: index out of bounds for read"); } return currArr[index2]; }; const write2 = (get, set, update) => { const ref = get(refAtom); const arr2 = get(arrAtom); const mapping2 = getMapping(arr2, ref.prev); const index2 = mapping2.keyList.indexOf(key); if (index2 < 0 || index2 >= arr2.length) { throw new Error("splitAtom: index out of bounds for write"); } const nextItem = isFunction(update) ? update(arr2[index2]) : update; set(arrAtom, [ ...arr2.slice(0, index2), nextItem, ...arr2.slice(index2 + 1) ]); }; atomList[index] = isWritable(arrAtom) ? atom(read2, write2) : atom(read2); }); if (prevMapping && prevMapping.keyList.length === keyList.length && prevMapping.keyList.every((x, i) => x === keyList[i])) { mapping = prevMapping; } else { mapping = { atomList, keyList }; } mappingCache.set(arr, mapping); return mapping; }; const refAtom = atom(() => ({})); const read = (get) => { const ref = get(refAtom); const arr = get(arrAtom); const mapping = getMapping(arr, ref.prev); ref.prev = arr; return mapping.atomList; }; const write = (get, set, action) => { if ("read" in action) { console.warn("atomToRemove is deprecated. use action with type"); action = { type: "remove", atom: action }; } switch (action.type) { case "remove": { const index = get(splittedAtom).indexOf(action.atom); if (index >= 0) { const arr = get(arrAtom); set(arrAtom, [ ...arr.slice(0, index), ...arr.slice(index + 1) ]); } break; } case "insert": { const index = action.before ? get(splittedAtom).indexOf(action.before) : get(splittedAtom).length; if (index >= 0) { const arr = get(arrAtom); set(arrAtom, [ ...arr.slice(0, index), action.value, ...arr.slice(index) ]); } break; } case "move": { const index1 = get(splittedAtom).indexOf(action.atom); const index2 = action.before ? get(splittedAtom).indexOf(action.before) : get(splittedAtom).length; if (index1 >= 0 && index2 >= 0) { const arr = get(arrAtom); if (index1 < index2) { set(arrAtom, [ ...arr.slice(0, index1), ...arr.slice(index1 + 1, index2), arr[index1], ...arr.slice(index2) ]); } else { set(arrAtom, [ ...arr.slice(0, index2), arr[index1], ...arr.slice(index2, index1), ...arr.slice(index1 + 1) ]); } } break; } } }; const splittedAtom = isWritable(arrAtom) ? atom(read, write) : atom(read); return splittedAtom; }, keyExtractor ? [arrAtom, keyExtractor] : [arrAtom] ); } function atomWithDefault(getDefault) { const EMPTY = Symbol(); const overwrittenAtom = atom(EMPTY); const anAtom = atom( (get) => { const overwritten = get(overwrittenAtom); if (overwritten !== EMPTY) { return overwritten; } return getDefault(get); }, (get, set, update) => { if (update === RESET) { return set(overwrittenAtom, EMPTY); } return set( overwrittenAtom, typeof update === "function" ? update(get(anAtom)) : update ); } ); return anAtom; } const memoizeAtom$1 = createMemoizeAtom(); const emptyArrayAtom = (0,jotai__WEBPACK_IMPORTED_MODULE_1__/* .atom */ .cn)(() => []); function waitForAll(atoms) { const createAtom = () => { const unwrappedAtoms = unwrapAtoms(atoms); const derivedAtom = atom((get) => { const promises = []; const values = unwrappedAtoms.map((anAtom, index) => { try { return get(anAtom); } catch (e) { if (e instanceof Promise) { promises[index] = e; } else { throw e; } } }); if (promises.length) { throw Promise.all(promises); } return wrapResults(atoms, values); }); return derivedAtom; }; if (Array.isArray(atoms)) { if (atoms.length) { return memoizeAtom$1(createAtom, atoms); } return emptyArrayAtom; } return createAtom(); } const unwrapAtoms = (atoms) => Array.isArray(atoms) ? atoms : Object.getOwnPropertyNames(atoms).map((key) => atoms[key]); const wrapResults = (atoms, results) => Array.isArray(atoms) ? results : Object.getOwnPropertyNames(atoms).reduce( (out, key, idx) => ({ ...out, [key]: results[idx] }), {} ); function createJSONStorage(getStringStorage) { let lastStr; let lastValue; return { getItem: (key) => { const parse = (str2) => { str2 = str2 || ""; if (lastStr !== str2) { lastValue = JSON.parse(str2); lastStr = str2; } return lastValue; }; const str = getStringStorage().getItem(key); if (str instanceof Promise) { return str.then(parse); } return parse(str); }, setItem: (key, newValue) => getStringStorage().setItem(key, JSON.stringify(newValue)), removeItem: (key) => getStringStorage().removeItem(key) }; } const defaultStorage = createJSONStorage(() => localStorage); defaultStorage.subscribe = (key, callback) => { const storageEventCallback = (e) => { if (e.key === key && e.newValue) { callback(JSON.parse(e.newValue)); } }; window.addEventListener("storage", storageEventCallback); return () => { window.removeEventListener("storage", storageEventCallback); }; }; function atomWithStorage(key, initialValue, storage = defaultStorage) { const getInitialValue = () => { try { const value = storage.getItem(key); if (value instanceof Promise) { return value.catch(() => initialValue); } return value; } catch { return initialValue; } }; const baseAtom = (0,jotai__WEBPACK_IMPORTED_MODULE_1__/* .atom */ .cn)(storage.delayInit ? initialValue : getInitialValue()); baseAtom.onMount = (setAtom) => { let unsub; if (storage.subscribe) { unsub = storage.subscribe(key, setAtom); setAtom(getInitialValue()); } if (storage.delayInit) { const value = getInitialValue(); if (value instanceof Promise) { value.then(setAtom); } else { setAtom(value); } } return unsub; }; const anAtom = (0,jotai__WEBPACK_IMPORTED_MODULE_1__/* .atom */ .cn)( (get) => get(baseAtom), (get, set, update) => { if (update === RESET) { set(baseAtom, initialValue); return storage.removeItem(key); } const newValue = typeof update === "function" ? update(get(baseAtom)) : update; set(baseAtom, newValue); return storage.setItem(key, newValue); } ); return anAtom; } function atomWithHash(key, initialValue, options) { const serialize = (options == null ? void 0 : options.serialize) || JSON.stringify; const deserialize = (options == null ? void 0 : options.deserialize) || JSON.parse; const subscribe = (options == null ? void 0 : options.subscribe) || ((callback) => { window.addEventListener("hashchange", callback); return () => { window.removeEventListener("hashchange", callback); }; }); const hashStorage = { getItem: (key2) => { const searchParams = new URLSearchParams(location.hash.slice(1)); const storedValue = searchParams.get(key2); if (storedValue === null) { throw new Error("no value stored"); } return deserialize(storedValue); }, setItem: (key2, newValue) => { const searchParams = new URLSearchParams(location.hash.slice(1)); searchParams.set(key2, serialize(newValue)); if (options == null ? void 0 : options.replaceState) { history.replaceState(null, "", "#" + searchParams.toString()); } else { location.hash = searchParams.toString(); } }, removeItem: (key2) => { const searchParams = new URLSearchParams(location.hash.slice(1)); searchParams.delete(key2); if (options == null ? void 0 : options.replaceState) { history.replaceState(null, "", "#" + searchParams.toString()); } else { location.hash = searchParams.toString(); } }, ...(options == null ? void 0 : options.delayInit) && { delayInit: true }, subscribe: (key2, setValue) => { const callback = () => { const searchParams = new URLSearchParams(location.hash.slice(1)); const str = searchParams.get(key2); if (str !== null) { setValue(deserialize(str)); } else { setValue(initialValue); } }; return subscribe(callback); } }; return atomWithStorage(key, initialValue, hashStorage); } function atomWithObservable(createObservable, options) { const observableResultAtom = atom((get) => { var _a; let observable = createObservable(get); const itself = (_a = observable[Symbol.observable]) == null ? void 0 : _a.call(observable); if (itself) { observable = itself; } const EMPTY = Symbol(); let resolveEmittedInitialValue = null; let initialEmittedValue = (options == null ? void 0 : options.initialValue) === void 0 ? new Promise((resolve) => { resolveEmittedInitialValue = resolve; }) : void 0; let initialValueWasEmitted = false; let emittedValueBeforeMount = EMPTY; let isSync = true; let setData = (data) => { if ((options == null ? void 0 : options.initialValue) === void 0 && !initialValueWasEmitted) { if (isSync) { initialEmittedValue = data; } resolveEmittedInitialValue == null ? void 0 : resolveEmittedInitialValue(data); initialValueWasEmitted = true; resolveEmittedInitialValue = null; } else { emittedValueBeforeMount = data; } }; const dataListener = (data) => { setData(data); }; const errorListener = (error) => { setData(Promise.reject(error)); }; let subscription = null; let initialValue; if ((options == null ? void 0 : options.initialValue) !== void 0) { initialValue = getInitialValue(options); } else { subscription = observable.subscribe(dataListener, errorListener); initialValue = initialEmittedValue; } isSync = false; const dataAtom = atom(initialValue); dataAtom.onMount = (update) => { setData = update; if (emittedValueBeforeMount !== EMPTY) { update(emittedValueBeforeMount); } if (!subscription) { subscription = observable.subscribe(dataListener, errorListener); } return () => { subscription == null ? void 0 : subscription.unsubscribe(); subscription = null; }; }; return { dataAtom, observable }; }); const observableAtom = atom( (get) => { const { dataAtom } = get(observableResultAtom); return get(dataAtom); }, (get, set, data) => { const { dataAtom, observable } = get(observableResultAtom); if ("next" in observable) { let subscription = null; const callback = (data2) => { set(dataAtom, data2); subscription == null ? void 0 : subscription.unsubscribe(); }; subscription = observable.subscribe(callback); observable.next(data); } else { throw new Error("observable is not subject"); } } ); return observableAtom; } function getInitialValue(options) { const initialValue = options.initialValue; return initialValue instanceof Function ? initialValue() : initialValue; } const hydratedMap = /* @__PURE__ */ new WeakMap(); function useHydrateAtoms(values, scope) { const ScopeContext = SECRET_INTERNAL_getScopeContext(scope); const scopeContainer = useContext(ScopeContext); const store = scopeContainer.s; const hydratedSet = getHydratedSet(scopeContainer); const tuplesToRestore = []; for (const tuple of values) { const atom = tuple[0]; if (!hydratedSet.has(atom)) { hydratedSet.add(atom); tuplesToRestore.push(tuple); } } if (tuplesToRestore.length) { store[RESTORE_ATOMS](tuplesToRestore); } } function getHydratedSet(scopeContainer) { let hydratedSet = hydratedMap.get(scopeContainer); if (!hydratedSet) { hydratedSet = /* @__PURE__ */ new WeakSet(); hydratedMap.set(scopeContainer, hydratedSet); } return hydratedSet; } const memoizeAtom = createMemoizeAtom(); const LOADING = { state: "loading" }; function loadable(anAtom) { return memoizeAtom(() => { const loadableAtomCache = /* @__PURE__ */ new WeakMap(); const catchAtom = atom((get) => { let promise; try { const data = get(anAtom); const loadableAtom2 = atom({ state: "hasData", data }); return loadableAtom2; } catch (error) { if (error instanceof Promise) { promise = error; } else { const loadableAtom2 = atom({ state: "hasError", error }); return loadableAtom2; } } const cached = loadableAtomCache.get(promise); if (cached) { return cached; } const loadableAtom = atom( LOADING, async (get2, set) => { try { const data = await get2(anAtom, { unstable_promise: true }); set(loadableAtom, { state: "hasData", data }); } catch (error) { set(loadableAtom, { state: "hasError", error }); } } ); loadableAtom.onMount = (init) => { init(); }; loadableAtomCache.set(promise, loadableAtom); return loadableAtom; }); const derivedAtom = atom((get) => { const loadableAtom = get(catchAtom); return get(loadableAtom); }); return derivedAtom; }, [anAtom]); } /***/ }), /***/ 91094: /***/ (function(module, exports, __webpack_require__) { /* provided dependency */ var process = __webpack_require__(34155); var __WEBPACK_AMD_DEFINE_RESULT__;/** * [js-sha3]{@link https://github.com/emn178/js-sha3} * * @version 0.8.0 * @author Chen, Yi-Cyuan [emn178@gmail.com] * @copyright Chen, Yi-Cyuan 2015-2018 * @license MIT */ /*jslint bitwise: true */ (function () { 'use strict'; var INPUT_ERROR = 'input is invalid type'; var FINALIZE_ERROR = 'finalize already called'; var WINDOW = typeof window === 'object'; var root = WINDOW ? window : {}; if (root.JS_SHA3_NO_WINDOW) { WINDOW = false; } var WEB_WORKER = !WINDOW && typeof self === 'object'; var NODE_JS = !root.JS_SHA3_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node; if (NODE_JS) { root = __webpack_require__.g; } else if (WEB_WORKER) { root = self; } var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && "object" === 'object' && module.exports; var AMD = true && __webpack_require__.amdO; var ARRAY_BUFFER = !root.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined'; var HEX_CHARS = '0123456789abcdef'.split(''); var SHAKE_PADDING = [31, 7936, 2031616, 520093696]; var CSHAKE_PADDING = [4, 1024, 262144, 67108864]; var KECCAK_PADDING = [1, 256, 65536, 16777216]; var PADDING = [6, 1536, 393216, 100663296]; var SHIFT = [0, 8, 16, 24]; var RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649, 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0, 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771, 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648, 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648]; var BITS = [224, 256, 384, 512]; var SHAKE_BITS = [128, 256]; var OUTPUT_TYPES = ['hex', 'buffer', 'arrayBuffer', 'array', 'digest']; var CSHAKE_BYTEPAD = { '128': 168, '256': 136 }; if (root.JS_SHA3_NO_NODE_JS || !Array.isArray) { Array.isArray = function (obj) { return Object.prototype.toString.call(obj) === '[object Array]'; }; } if (ARRAY_BUFFER && (root.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) { ArrayBuffer.isView = function (obj) { return typeof obj === 'object' && obj.buffer && obj.buffer.constructor === ArrayBuffer; }; } var createOutputMethod = function (bits, padding, outputType) { return function (message) { return new Keccak(bits, padding, bits).update(message)[outputType](); }; }; var createShakeOutputMethod = function (bits, padding, outputType) { return function (message, outputBits) { return new Keccak(bits, padding, outputBits).update(message)[outputType](); }; }; var createCshakeOutputMethod = function (bits, padding, outputType) { return function (message, outputBits, n, s) { return methods['cshake' + bits].update(message, outputBits, n, s)[outputType](); }; }; var createKmacOutputMethod = function (bits, padding, outputType) { return function (key, message, outputBits, s) { return methods['kmac' + bits].update(key, message, outputBits, s)[outputType](); }; }; var createOutputMethods = function (method, createMethod, bits, padding) { for (var i = 0; i < OUTPUT_TYPES.length; ++i) { var type = OUTPUT_TYPES[i]; method[type] = createMethod(bits, padding, type); } return method; }; var createMethod = function (bits, padding) { var method = createOutputMethod(bits, padding, 'hex'); method.create = function () { return new Keccak(bits, padding, bits); }; method.update = function (message) { return method.create().update(message); }; return createOutputMethods(method, createOutputMethod, bits, padding); }; var createShakeMethod = function (bits, padding) { var method = createShakeOutputMethod(bits, padding, 'hex'); method.create = function (outputBits) { return new Keccak(bits, padding, outputBits); }; method.update = function (message, outputBits) { return method.create(outputBits).update(message); }; return createOutputMethods(method, createShakeOutputMethod, bits, padding); }; var createCshakeMethod = function (bits, padding) { var w = CSHAKE_BYTEPAD[bits]; var method = createCshakeOutputMethod(bits, padding, 'hex'); method.create = function (outputBits, n, s) { if (!n && !s) { return methods['shake' + bits].create(outputBits); } else { return new Keccak(bits, padding, outputBits).bytepad([n, s], w); } }; method.update = function (message, outputBits, n, s) { return method.create(outputBits, n, s).update(message); }; return createOutputMethods(method, createCshakeOutputMethod, bits, padding); }; var createKmacMethod = function (bits, padding) { var w = CSHAKE_BYTEPAD[bits]; var method = createKmacOutputMethod(bits, padding, 'hex'); method.create = function (key, outputBits, s) { return new Kmac(bits, padding, outputBits).bytepad(['KMAC', s], w).bytepad([key], w); }; method.update = function (key, message, outputBits, s) { return method.create(key, outputBits, s).update(message); }; return createOutputMethods(method, createKmacOutputMethod, bits, padding); }; var algorithms = [ { name: 'keccak', padding: KECCAK_PADDING, bits: BITS, createMethod: createMethod }, { name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod }, { name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod }, { name: 'cshake', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createCshakeMethod }, { name: 'kmac', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createKmacMethod } ]; var methods = {}, methodNames = []; for (var i = 0; i < algorithms.length; ++i) { var algorithm = algorithms[i]; var bits = algorithm.bits; for (var j = 0; j < bits.length; ++j) { var methodName = algorithm.name + '_' + bits[j]; methodNames.push(methodName); methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding); if (algorithm.name !== 'sha3') { var newMethodName = algorithm.name + bits[j]; methodNames.push(newMethodName); methods[newMethodName] = methods[methodName]; } } } function Keccak(bits, padding, outputBits) { this.blocks = []; this.s = []; this.padding = padding; this.outputBits = outputBits; this.reset = true; this.finalized = false; this.block = 0; this.start = 0; this.blockCount = (1600 - (bits << 1)) >> 5; this.byteCount = this.blockCount << 2; this.outputBlocks = outputBits >> 5; this.extraBytes = (outputBits & 31) >> 3; for (var i = 0; i < 50; ++i) { this.s[i] = 0; } } Keccak.prototype.update = function (message) { if (this.finalized) { throw new Error(FINALIZE_ERROR); } var notString, type = typeof message; if (type !== 'string') { if (type === 'object') { if (message === null) { throw new Error(INPUT_ERROR); } else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) { message = new Uint8Array(message); } else if (!Array.isArray(message)) { if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) { throw new Error(INPUT_ERROR); } } } else { throw new Error(INPUT_ERROR); } notString = true; } var blocks = this.blocks, byteCount = this.byteCount, length = message.length, blockCount = this.blockCount, index = 0, s = this.s, i, code; while (index < length) { if (this.reset) { this.reset = false; blocks[0] = this.block; for (i = 1; i < blockCount + 1; ++i) { blocks[i] = 0; } } if (notString) { for (i = this.start; index < length && i < byteCount; ++index) { blocks[i >> 2] |= message[index] << SHIFT[i++ & 3]; } } else { for (i = this.start; index < length && i < byteCount; ++index) { code = message.charCodeAt(index); if (code < 0x80) { blocks[i >> 2] |= code << SHIFT[i++ & 3]; } else if (code < 0x800) { blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3]; blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; } else if (code < 0xd800 || code >= 0xe000) { blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3]; blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; } else { code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff)); blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3]; blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3]; blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; } } } this.lastByteIndex = i; if (i >= byteCount) { this.start = i - byteCount; this.block = blocks[blockCount]; for (i = 0; i < blockCount; ++i) { s[i] ^= blocks[i]; } f(s); this.reset = true; } else { this.start = i; } } return this; }; Keccak.prototype.encode = function (x, right) { var o = x & 255, n = 1; var bytes = [o]; x = x >> 8; o = x & 255; while (o > 0) { bytes.unshift(o); x = x >> 8; o = x & 255; ++n; } if (right) { bytes.push(n); } else { bytes.unshift(n); } this.update(bytes); return bytes.length; }; Keccak.prototype.encodeString = function (str) { var notString, type = typeof str; if (type !== 'string') { if (type === 'object') { if (str === null) { throw new Error(INPUT_ERROR); } else if (ARRAY_BUFFER && str.constructor === ArrayBuffer) { str = new Uint8Array(str); } else if (!Array.isArray(str)) { if (!ARRAY_BUFFER || !ArrayBuffer.isView(str)) { throw new Error(INPUT_ERROR); } } } else { throw new Error(INPUT_ERROR); } notString = true; } var bytes = 0, length = str.length; if (notString) { bytes = length; } else { for (var i = 0; i < str.length; ++i) { var code = str.charCodeAt(i); if (code < 0x80) { bytes += 1; } else if (code < 0x800) { bytes += 2; } else if (code < 0xd800 || code >= 0xe000) { bytes += 3; } else { code = 0x10000 + (((code & 0x3ff) << 10) | (str.charCodeAt(++i) & 0x3ff)); bytes += 4; } } } bytes += this.encode(bytes * 8); this.update(str); return bytes; }; Keccak.prototype.bytepad = function (strs, w) { var bytes = this.encode(w); for (var i = 0; i < strs.length; ++i) { bytes += this.encodeString(strs[i]); } var paddingBytes = w - bytes % w; var zeros = []; zeros.length = paddingBytes; this.update(zeros); return this; }; Keccak.prototype.finalize = function () { if (this.finalized) { return; } this.finalized = true; var blocks = this.blocks, i = this.lastByteIndex, blockCount = this.blockCount, s = this.s; blocks[i >> 2] |= this.padding[i & 3]; if (this.lastByteIndex === this.byteCount) { blocks[0] = blocks[blockCount]; for (i = 1; i < blockCount + 1; ++i) { blocks[i] = 0; } } blocks[blockCount - 1] |= 0x80000000; for (i = 0; i < blockCount; ++i) { s[i] ^= blocks[i]; } f(s); }; Keccak.prototype.toString = Keccak.prototype.hex = function () { this.finalize(); var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, extraBytes = this.extraBytes, i = 0, j = 0; var hex = '', block; while (j < outputBlocks) { for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { block = s[i]; hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F] + HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F] + HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F] + HEX_CHARS[(block >> 28) & 0x0F] + HEX_CHARS[(block >> 24) & 0x0F]; } if (j % blockCount === 0) { f(s); i = 0; } } if (extraBytes) { block = s[i]; hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F]; if (extraBytes > 1) { hex += HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F]; } if (extraBytes > 2) { hex += HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F]; } } return hex; }; Keccak.prototype.arrayBuffer = function () { this.finalize(); var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, extraBytes = this.extraBytes, i = 0, j = 0; var bytes = this.outputBits >> 3; var buffer; if (extraBytes) { buffer = new ArrayBuffer((outputBlocks + 1) << 2); } else { buffer = new ArrayBuffer(bytes); } var array = new Uint32Array(buffer); while (j < outputBlocks) { for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { array[j] = s[i]; } if (j % blockCount === 0) { f(s); } } if (extraBytes) { array[i] = s[i]; buffer = buffer.slice(0, bytes); } return buffer; }; Keccak.prototype.buffer = Keccak.prototype.arrayBuffer; Keccak.prototype.digest = Keccak.prototype.array = function () { this.finalize(); var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, extraBytes = this.extraBytes, i = 0, j = 0; var array = [], offset, block; while (j < outputBlocks) { for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { offset = j << 2; block = s[i]; array[offset] = block & 0xFF; array[offset + 1] = (block >> 8) & 0xFF; array[offset + 2] = (block >> 16) & 0xFF; array[offset + 3] = (block >> 24) & 0xFF; } if (j % blockCount === 0) { f(s); } } if (extraBytes) { offset = j << 2; block = s[i]; array[offset] = block & 0xFF; if (extraBytes > 1) { array[offset + 1] = (block >> 8) & 0xFF; } if (extraBytes > 2) { array[offset + 2] = (block >> 16) & 0xFF; } } return array; }; function Kmac(bits, padding, outputBits) { Keccak.call(this, bits, padding, outputBits); } Kmac.prototype = new Keccak(); Kmac.prototype.finalize = function () { this.encode(this.outputBits, true); return Keccak.prototype.finalize.call(this); }; var f = function (s) { var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33, b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49; for (n = 0; n < 48; n += 2) { c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40]; c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41]; c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42]; c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43]; c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44]; c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45]; c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46]; c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47]; c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48]; c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49]; h = c8 ^ ((c2 << 1) | (c3 >>> 31)); l = c9 ^ ((c3 << 1) | (c2 >>> 31)); s[0] ^= h; s[1] ^= l; s[10] ^= h; s[11] ^= l; s[20] ^= h; s[21] ^= l; s[30] ^= h; s[31] ^= l; s[40] ^= h; s[41] ^= l; h = c0 ^ ((c4 << 1) | (c5 >>> 31)); l = c1 ^ ((c5 << 1) | (c4 >>> 31)); s[2] ^= h; s[3] ^= l; s[12] ^= h; s[13] ^= l; s[22] ^= h; s[23] ^= l; s[32] ^= h; s[33] ^= l; s[42] ^= h; s[43] ^= l; h = c2 ^ ((c6 << 1) | (c7 >>> 31)); l = c3 ^ ((c7 << 1) | (c6 >>> 31)); s[4] ^= h; s[5] ^= l; s[14] ^= h; s[15] ^= l; s[24] ^= h; s[25] ^= l; s[34] ^= h; s[35] ^= l; s[44] ^= h; s[45] ^= l; h = c4 ^ ((c8 << 1) | (c9 >>> 31)); l = c5 ^ ((c9 << 1) | (c8 >>> 31)); s[6] ^= h; s[7] ^= l; s[16] ^= h; s[17] ^= l; s[26] ^= h; s[27] ^= l; s[36] ^= h; s[37] ^= l; s[46] ^= h; s[47] ^= l; h = c6 ^ ((c0 << 1) | (c1 >>> 31)); l = c7 ^ ((c1 << 1) | (c0 >>> 31)); s[8] ^= h; s[9] ^= l; s[18] ^= h; s[19] ^= l; s[28] ^= h; s[29] ^= l; s[38] ^= h; s[39] ^= l; s[48] ^= h; s[49] ^= l; b0 = s[0]; b1 = s[1]; b32 = (s[11] << 4) | (s[10] >>> 28); b33 = (s[10] << 4) | (s[11] >>> 28); b14 = (s[20] << 3) | (s[21] >>> 29); b15 = (s[21] << 3) | (s[20] >>> 29); b46 = (s[31] << 9) | (s[30] >>> 23); b47 = (s[30] << 9) | (s[31] >>> 23); b28 = (s[40] << 18) | (s[41] >>> 14); b29 = (s[41] << 18) | (s[40] >>> 14); b20 = (s[2] << 1) | (s[3] >>> 31); b21 = (s[3] << 1) | (s[2] >>> 31); b2 = (s[13] << 12) | (s[12] >>> 20); b3 = (s[12] << 12) | (s[13] >>> 20); b34 = (s[22] << 10) | (s[23] >>> 22); b35 = (s[23] << 10) | (s[22] >>> 22); b16 = (s[33] << 13) | (s[32] >>> 19); b17 = (s[32] << 13) | (s[33] >>> 19); b48 = (s[42] << 2) | (s[43] >>> 30); b49 = (s[43] << 2) | (s[42] >>> 30); b40 = (s[5] << 30) | (s[4] >>> 2); b41 = (s[4] << 30) | (s[5] >>> 2); b22 = (s[14] << 6) | (s[15] >>> 26); b23 = (s[15] << 6) | (s[14] >>> 26); b4 = (s[25] << 11) | (s[24] >>> 21); b5 = (s[24] << 11) | (s[25] >>> 21); b36 = (s[34] << 15) | (s[35] >>> 17); b37 = (s[35] << 15) | (s[34] >>> 17); b18 = (s[45] << 29) | (s[44] >>> 3); b19 = (s[44] << 29) | (s[45] >>> 3); b10 = (s[6] << 28) | (s[7] >>> 4); b11 = (s[7] << 28) | (s[6] >>> 4); b42 = (s[17] << 23) | (s[16] >>> 9); b43 = (s[16] << 23) | (s[17] >>> 9); b24 = (s[26] << 25) | (s[27] >>> 7); b25 = (s[27] << 25) | (s[26] >>> 7); b6 = (s[36] << 21) | (s[37] >>> 11); b7 = (s[37] << 21) | (s[36] >>> 11); b38 = (s[47] << 24) | (s[46] >>> 8); b39 = (s[46] << 24) | (s[47] >>> 8); b30 = (s[8] << 27) | (s[9] >>> 5); b31 = (s[9] << 27) | (s[8] >>> 5); b12 = (s[18] << 20) | (s[19] >>> 12); b13 = (s[19] << 20) | (s[18] >>> 12); b44 = (s[29] << 7) | (s[28] >>> 25); b45 = (s[28] << 7) | (s[29] >>> 25); b26 = (s[38] << 8) | (s[39] >>> 24); b27 = (s[39] << 8) | (s[38] >>> 24); b8 = (s[48] << 14) | (s[49] >>> 18); b9 = (s[49] << 14) | (s[48] >>> 18); s[0] = b0 ^ (~b2 & b4); s[1] = b1 ^ (~b3 & b5); s[10] = b10 ^ (~b12 & b14); s[11] = b11 ^ (~b13 & b15); s[20] = b20 ^ (~b22 & b24); s[21] = b21 ^ (~b23 & b25); s[30] = b30 ^ (~b32 & b34); s[31] = b31 ^ (~b33 & b35); s[40] = b40 ^ (~b42 & b44); s[41] = b41 ^ (~b43 & b45); s[2] = b2 ^ (~b4 & b6); s[3] = b3 ^ (~b5 & b7); s[12] = b12 ^ (~b14 & b16); s[13] = b13 ^ (~b15 & b17); s[22] = b22 ^ (~b24 & b26); s[23] = b23 ^ (~b25 & b27); s[32] = b32 ^ (~b34 & b36); s[33] = b33 ^ (~b35 & b37); s[42] = b42 ^ (~b44 & b46); s[43] = b43 ^ (~b45 & b47); s[4] = b4 ^ (~b6 & b8); s[5] = b5 ^ (~b7 & b9); s[14] = b14 ^ (~b16 & b18); s[15] = b15 ^ (~b17 & b19); s[24] = b24 ^ (~b26 & b28); s[25] = b25 ^ (~b27 & b29); s[34] = b34 ^ (~b36 & b38); s[35] = b35 ^ (~b37 & b39); s[44] = b44 ^ (~b46 & b48); s[45] = b45 ^ (~b47 & b49); s[6] = b6 ^ (~b8 & b0); s[7] = b7 ^ (~b9 & b1); s[16] = b16 ^ (~b18 & b10); s[17] = b17 ^ (~b19 & b11); s[26] = b26 ^ (~b28 & b20); s[27] = b27 ^ (~b29 & b21); s[36] = b36 ^ (~b38 & b30); s[37] = b37 ^ (~b39 & b31); s[46] = b46 ^ (~b48 & b40); s[47] = b47 ^ (~b49 & b41); s[8] = b8 ^ (~b0 & b2); s[9] = b9 ^ (~b1 & b3); s[18] = b18 ^ (~b10 & b12); s[19] = b19 ^ (~b11 & b13); s[28] = b28 ^ (~b20 & b22); s[29] = b29 ^ (~b21 & b23); s[38] = b38 ^ (~b30 & b32); s[39] = b39 ^ (~b31 & b33); s[48] = b48 ^ (~b40 & b42); s[49] = b49 ^ (~b41 & b43); s[0] ^= RC[n]; s[1] ^= RC[n + 1]; } }; if (COMMON_JS) { module.exports = methods; } else { for (i = 0; i < methodNames.length; ++i) { root[methodNames[i]] = methods[methodNames[i]]; } if (AMD) { !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () { return methods; }).call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } } })(); /***/ }), /***/ 39499: /***/ (function(module) { (function(i,_){ true?module.exports=_():0})(this,function(){'use strict';var i=Math.imul,_=Math.clz32,t=Math.abs,e=Math.max,g=Math.floor;class o extends Array{constructor(i,_){if(super(i),this.sign=_,i>o.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded")}static BigInt(i){var _=Number.isFinite;if("number"==typeof i){if(0===i)return o.__zero();if(o.__isOneDigitInt(i))return 0>i?o.__oneDigit(-i,!0):o.__oneDigit(i,!1);if(!_(i)||g(i)!==i)throw new RangeError("The number "+i+" cannot be converted to BigInt because it is not an integer");return o.__fromDouble(i)}if("string"==typeof i){const _=o.__fromString(i);if(null===_)throw new SyntaxError("Cannot convert "+i+" to a BigInt");return _}if("boolean"==typeof i)return!0===i?o.__oneDigit(1,!1):o.__zero();if("object"==typeof i){if(i.constructor===o)return i;const _=o.__toPrimitive(i);return o.BigInt(_)}throw new TypeError("Cannot convert "+i+" to a BigInt")}toDebugString(){const i=["BigInt["];for(const _ of this)i.push((_?(_>>>0).toString(16):_)+", ");return i.push("]"),i.join("")}toString(i=10){if(2>i||36>>=12;const u=r-12;let d=12<=r?0:s<<20+r,h=20+r;for(0>>30-u,d=s<>>30-h,h-=30;const m=o.__decideRounding(i,h,l,s);if((1===m||0===m&&1==(1&d))&&(d=d+1>>>0,0===d&&(a++,0!=a>>>20&&(a=0,g++,1023=o.__kMaxLengthBits)throw new RangeError("BigInt too big");if(1===i.length&&2===i.__digit(0)){const _=1+(0|t/30),e=i.sign&&0!=(1&t),n=new o(_,e);n.__initializeDigits();const g=1<>=1;0!==t;t>>=1)n=o.multiply(n,n),0!=(1&t)&&(null===e?e=n:e=o.multiply(e,n));return e}static multiply(_,t){if(0===_.length)return _;if(0===t.length)return t;let i=_.length+t.length;30<=_.__clzmsd()+t.__clzmsd()&&i--;const e=new o(i,_.sign!==t.sign);e.__initializeDigits();for(let n=0;n<_.length;n++)o.__multiplyAccumulate(t,_.__digit(n),e,n);return e.__trim()}static divide(i,_){if(0===_.length)throw new RangeError("Division by zero");if(0>o.__absoluteCompare(i,_))return o.__zero();const t=i.sign!==_.sign,e=_.__unsignedDigit(0);let n;if(1===_.length&&32767>=e){if(1===e)return t===i.sign?i:o.unaryMinus(i);n=o.__absoluteDivSmall(i,e,null)}else n=o.__absoluteDivLarge(i,_,!0,!1);return n.sign=t,n.__trim()}static remainder(i,_){if(0===_.length)throw new RangeError("Division by zero");if(0>o.__absoluteCompare(i,_))return i;const t=_.__unsignedDigit(0);if(1===_.length&&32767>=t){if(1===t)return o.__zero();const _=o.__absoluteModSmall(i,t);return 0===_?o.__zero():o.__oneDigit(_,i.sign)}const e=o.__absoluteDivLarge(i,_,!1,!0);return e.sign=i.sign,e.__trim()}static add(i,_){const t=i.sign;return t===_.sign?o.__absoluteAdd(i,_,t):0<=o.__absoluteCompare(i,_)?o.__absoluteSub(i,_,t):o.__absoluteSub(_,i,!t)}static subtract(i,_){const t=i.sign;return t===_.sign?0<=o.__absoluteCompare(i,_)?o.__absoluteSub(i,_,t):o.__absoluteSub(_,i,!t):o.__absoluteAdd(i,_,t)}static leftShift(i,_){return 0===_.length||0===i.length?i:_.sign?o.__rightShiftByAbsolute(i,_):o.__leftShiftByAbsolute(i,_)}static signedRightShift(i,_){return 0===_.length||0===i.length?i:_.sign?o.__leftShiftByAbsolute(i,_):o.__rightShiftByAbsolute(i,_)}static unsignedRightShift(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}static lessThan(i,_){return 0>o.__compareToBigInt(i,_)}static lessThanOrEqual(i,_){return 0>=o.__compareToBigInt(i,_)}static greaterThan(i,_){return 0_)throw new RangeError("Invalid value: not (convertible to) a safe integer");if(0===_)return o.__zero();if(_>=o.__kMaxLengthBits)return t;const e=0|(_+29)/30;if(t.lengthi)throw new RangeError("Invalid value: not (convertible to) a safe integer");if(0===i)return o.__zero();if(_.sign){if(i>o.__kMaxLengthBits)throw new RangeError("BigInt too big");return o.__truncateAndSubFromPowerOfTwo(i,_,!1)}if(i>=o.__kMaxLengthBits)return _;const t=0|(i+29)/30;if(_.length>>e)return _}return o.__truncateToNBits(i,_)}static ADD(i,_){if(i=o.__toPrimitive(i),_=o.__toPrimitive(_),"string"==typeof i)return"string"!=typeof _&&(_=_.toString()),i+_;if("string"==typeof _)return i.toString()+_;if(i=o.__toNumeric(i),_=o.__toNumeric(_),o.__isBigInt(i)&&o.__isBigInt(_))return o.add(i,_);if("number"==typeof i&&"number"==typeof _)return i+_;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}static LT(i,_){return o.__compare(i,_,0)}static LE(i,_){return o.__compare(i,_,1)}static GT(i,_){return o.__compare(i,_,2)}static GE(i,_){return o.__compare(i,_,3)}static EQ(i,_){for(;;){if(o.__isBigInt(i))return o.__isBigInt(_)?o.equal(i,_):o.EQ(_,i);if("number"==typeof i){if(o.__isBigInt(_))return o.__equalToNumber(_,i);if("object"!=typeof _)return i==_;_=o.__toPrimitive(_)}else if("string"==typeof i){if(o.__isBigInt(_))return i=o.__fromString(i),null!==i&&o.equal(i,_);if("object"!=typeof _)return i==_;_=o.__toPrimitive(_)}else if("boolean"==typeof i){if(o.__isBigInt(_))return o.__equalToNumber(_,+i);if("object"!=typeof _)return i==_;_=o.__toPrimitive(_)}else if("symbol"==typeof i){if(o.__isBigInt(_))return!1;if("object"!=typeof _)return i==_;_=o.__toPrimitive(_)}else if("object"==typeof i){if("object"==typeof _&&_.constructor!==o)return i==_;i=o.__toPrimitive(i)}else return i==_}}static NE(i,_){return!o.EQ(i,_)}static __zero(){return new o(0,!1)}static __oneDigit(i,_){const t=new o(1,_);return t.__setDigit(0,i),t}__copy(){const _=new o(this.length,this.sign);for(let t=0;t_)n=-_-1;else{if(0===t)return-1;t--,e=i.__digit(t),n=29}let g=1<>>20,t=_-1023,e=(0|t/30)+1,n=new o(e,0>i);let g=1048575&o.__kBitConversionInts[1]|1048576,s=o.__kBitConversionInts[0];const l=20,r=t%30;let a,u=0;if(20>r){const i=l-r;u=i+32,a=g>>>i,g=g<<32-i|s>>>i,s<<=32-i}else if(20===r)u=32,a=g,g=s,s=0;else{const i=r-l;u=32-i,a=g<>>32-i,g=s<>>2,g=g<<30|s>>>2,s<<=30):a=0,n.__setDigit(_,a);return n.__trim()}static __isWhitespace(i){return!!(13>=i&&9<=i)||(159>=i?32==i:131071>=i?160==i||5760==i:196607>=i?(i&=131071,10>=i||40==i||41==i||47==i||95==i||4096==i):65279==i)}static __fromString(i,_=0){let t=0;const e=i.length;let n=0;if(n===e)return o.__zero();let g=i.charCodeAt(n);for(;o.__isWhitespace(g);){if(++n===e)return o.__zero();g=i.charCodeAt(n)}if(43===g){if(++n===e)return null;g=i.charCodeAt(n),t=1}else if(45===g){if(++n===e)return null;g=i.charCodeAt(n),t=-1}if(0===_){if(_=10,48===g){if(++n===e)return o.__zero();if(g=i.charCodeAt(n),88===g||120===g){if(_=16,++n===e)return null;g=i.charCodeAt(n)}else if(79===g||111===g){if(_=8,++n===e)return null;g=i.charCodeAt(n)}else if(66===g||98===g){if(_=2,++n===e)return null;g=i.charCodeAt(n)}}}else if(16===_&&48===g){if(++n===e)return o.__zero();if(g=i.charCodeAt(n),88===g||120===g){if(++n===e)return null;g=i.charCodeAt(n)}}if(0!=t&&10!==_)return null;for(;48===g;){if(++n===e)return o.__zero();g=i.charCodeAt(n)}const s=e-n;let l=o.__kMaxBitsPerChar[_],r=o.__kBitsPerCharTableMultiplier-1;if(s>1073741824/l)return null;const a=l*s+r>>>o.__kBitsPerCharTableShift,u=new o(0|(a+29)/30,!1),h=10>_?_:10,b=10<_?_-10:0;if(0==(_&_-1)){l>>=o.__kBitsPerCharTableShift;const _=[],t=[];let s=!1;do{let o=0,r=0;for(;;){let _;if(g-48>>>0>>0>>0>>0>>o.__kBitsPerCharTableShift)/30;u.__inplaceMultiplyAdd(D,a,c)}while(!t)}if(n!==e){if(!o.__isWhitespace(g))return null;for(n++;n>>l-o)}if(0!==g){if(n>=_.length)throw new Error("implementation bug");_.__setDigit(n++,g)}for(;n<_.length;n++)_.__setDigit(n,0)}static __toStringBasePowerOfTwo(_,i){const t=_.length;let e=i-1;e=(85&e>>>1)+(85&e),e=(51&e>>>2)+(51&e),e=(15&e>>>4)+(15&e);const n=e,g=i-1,s=_.__digit(t-1),l=o.__clz30(s);let r=0|(30*t-l+n-1)/n;if(_.sign&&r++,268435456>>s,h=30-s;h>=n;)a[u--]=o.__kConversionChars[d&g],d>>>=n,h-=n}const m=(d|s<>>n-h;0!==d;)a[u--]=o.__kConversionChars[d&g],d>>>=n;if(_.sign&&(a[u--]="-"),-1!=u)throw new Error("implementation bug");return a.join("")}static __toStringGeneric(_,i,t){const e=_.length;if(0===e)return"";if(1===e){let e=_.__unsignedDigit(0).toString(i);return!1===t&&_.sign&&(e="-"+e),e}const n=30*e-o.__clz30(_.__digit(e-1)),g=o.__kMaxBitsPerChar[i],s=g-1;let l=n*o.__kBitsPerCharTableMultiplier;l+=s-1,l=0|l/s;const r=l+1>>1,a=o.exponentiate(o.__oneDigit(i,!1),o.__oneDigit(r,!1));let u,d;const h=a.__unsignedDigit(0);if(1===a.length&&32767>=h){u=new o(_.length,!1),u.__initializeDigits();let t=0;for(let e=2*_.length-1;0<=e;e--){const i=t<<15|_.__halfDigit(e);u.__setHalfDigit(e,0|i/h),t=0|i%h}d=t.toString(i)}else{const t=o.__absoluteDivLarge(_,a,!0,!0);u=t.quotient;const e=t.remainder.__trim();d=o.__toStringGeneric(e,i,!0)}u.__trim();let m=o.__toStringGeneric(u,i,!0);for(;d.lengthe?o.__absoluteLess(t):0}static __compareToNumber(i,_){if(o.__isOneDigitInt(_)){const e=i.sign,n=0>_;if(e!==n)return o.__unequalSign(e);if(0===i.length){if(n)throw new Error("implementation bug");return 0===_?0:-1}if(1g?o.__absoluteGreater(e):s_)return o.__unequalSign(t);if(0===_)throw new Error("implementation bug: should be handled elsewhere");if(0===i.length)return-1;o.__kBitConversionDouble[0]=_;const e=2047&o.__kBitConversionInts[1]>>>20;if(2047==e)throw new Error("implementation bug: handled elsewhere");const n=e-1023;if(0>n)return o.__absoluteGreater(t);const g=i.length;let s=i.__digit(g-1);const l=o.__clz30(s),r=30*g-l,a=n+1;if(ra)return o.__absoluteGreater(t);let u=1048576|1048575&o.__kBitConversionInts[1],d=o.__kBitConversionInts[0];const h=20,m=29-l;if(m!==(0|(r-1)%30))throw new Error("implementation bug");let b,D=0;if(20>m){const i=h-m;D=i+32,b=u>>>i,u=u<<32-i|d>>>i,d<<=32-i}else if(20===m)D=32,b=u,u=d,d=0;else{const i=m-h;D=32-i,b=u<>>32-i,u=d<>>=0,b>>>=0,s>b)return o.__absoluteGreater(t);if(s>>2,u=u<<30|d>>>2,d<<=30):b=0;const _=i.__unsignedDigit(e);if(_>b)return o.__absoluteGreater(t);if(__&&i.__unsignedDigit(0)===t(_):0===o.__compareToDouble(i,_)}static __comparisonResultToBool(i,_){return 0===_?0>i:1===_?0>=i:2===_?0_;case 3:return i>=_;}if(o.__isBigInt(i)&&"string"==typeof _)return _=o.__fromString(_),null!==_&&o.__comparisonResultToBool(o.__compareToBigInt(i,_),t);if("string"==typeof i&&o.__isBigInt(_))return i=o.__fromString(i),null!==i&&o.__comparisonResultToBool(o.__compareToBigInt(i,_),t);if(i=o.__toNumeric(i),_=o.__toNumeric(_),o.__isBigInt(i)){if(o.__isBigInt(_))return o.__comparisonResultToBool(o.__compareToBigInt(i,_),t);if("number"!=typeof _)throw new Error("implementation bug");return o.__comparisonResultToBool(o.__compareToNumber(i,_),t)}if("number"!=typeof i)throw new Error("implementation bug");if(o.__isBigInt(_))return o.__comparisonResultToBool(o.__compareToNumber(_,i),2^t);if("number"!=typeof _)throw new Error("implementation bug");return 0===t?i<_:1===t?i<=_:2===t?i>_:3===t?i>=_:void 0}__clzmsd(){return o.__clz30(this.__digit(this.length-1))}static __absoluteAdd(_,t,e){if(_.length>>30,g.__setDigit(l,1073741823&i)}for(;l<_.length;l++){const i=_.__digit(l)+s;s=i>>>30,g.__setDigit(l,1073741823&i)}return l>>30,n.__setDigit(s,1073741823&i)}for(;s<_.length;s++){const i=_.__digit(s)-g;g=1&i>>>30,n.__setDigit(s,1073741823&i)}return n.__trim()}static __absoluteAddOne(_,i,t=null){const e=_.length;null===t?t=new o(e,i):t.sign=i;let n=1;for(let g=0;g>>30,t.__setDigit(g,1073741823&i)}return 0!=n&&t.__setDigitGrow(e,1),t}static __absoluteSubOne(_,t){const e=_.length;t=t||e;const n=new o(t,!1);let g=1;for(let o=0;o>>30,n.__setDigit(o,1073741823&i)}if(0!=g)throw new Error("implementation bug");for(let g=e;gn?0:_.__unsignedDigit(n)>t.__unsignedDigit(n)?1:-1}static __multiplyAccumulate(_,t,e,n){if(0===t)return;const g=32767&t,s=t>>>15;let l=0,r=0;for(let a,u=0;u<_.length;u++,n++){a=e.__digit(n);const i=_.__digit(u),t=32767&i,d=i>>>15,h=o.__imul(t,g),m=o.__imul(t,s),b=o.__imul(d,g),D=o.__imul(d,s);a+=r+h+l,l=a>>>30,a&=1073741823,a+=((32767&m)<<15)+((32767&b)<<15),l+=a>>>30,r=D+(m>>>15)+(b>>>15),e.__setDigit(n,1073741823&a)}for(;0!=l||0!==r;n++){let i=e.__digit(n);i+=l+r,r=0,l=i>>>30,e.__setDigit(n,1073741823&i)}}static __internalMultiplyAdd(_,t,e,g,s){let l=e,a=0;for(let n=0;n>>15,t),u=e+((32767&g)<<15)+a+l;l=u>>>30,a=g>>>15,s.__setDigit(n,1073741823&u)}if(s.length>g)for(s.__setDigit(g++,l+a);gthis.length&&(t=this.length);const e=32767&i,n=i>>>15;let g=0,s=_;for(let l=0;l>>15,r=o.__imul(_,e),a=o.__imul(_,n),u=o.__imul(t,e),d=o.__imul(t,n);let h=s+r+g;g=h>>>30,h&=1073741823,h+=((32767&a)<<15)+((32767&u)<<15),g+=h>>>30,s=d+(a>>>15)+(u>>>15),this.__setDigit(l,1073741823&h)}if(0!=g||0!==s)throw new Error("implementation bug")}static __absoluteDivSmall(_,t,e=null){null===e&&(e=new o(_.length,!1));let n=0;for(let g,o=2*_.length-1;0<=o;o-=2){g=(n<<15|_.__halfDigit(o))>>>0;const i=0|g/t;n=0|g%t,g=(n<<15|_.__halfDigit(o-1))>>>0;const s=0|g/t;n=0|g%t,e.__setDigit(o>>>1,i<<15|s)}return e}static __absoluteModSmall(_,t){let e=0;for(let n=2*_.length-1;0<=n;n--){const i=(e<<15|_.__halfDigit(n))>>>0;e=0|i%t}return e}static __absoluteDivLarge(i,_,t,e){const g=_.__halfDigitLength(),n=_.length,s=i.__halfDigitLength()-g;let l=null;t&&(l=new o(s+2>>>1,!1),l.__initializeDigits());const r=new o(g+2>>>1,!1);r.__initializeDigits();const a=o.__clz15(_.__halfDigit(g-1));0>>0;a=0|t/u;let e=0|t%u;const n=_.__halfDigit(g-2),s=d.__halfDigit(m+g-2);for(;o.__imul(a,n)>>>0>(e<<16|s)>>>0&&(a--,e+=u,!(32767>>1,h|a))}if(e)return d.__inplaceRightShift(a),t?{quotient:l,remainder:d}:d;if(t)return l;throw new Error("unreachable")}static __clz15(i){return o.__clz30(i)-15}__inplaceAdd(_,t,e){let n=0;for(let g=0;g>>15,this.__setHalfDigit(t+g,32767&i)}return n}__inplaceSub(_,t,e){let n=0;if(1&t){t>>=1;let g=this.__digit(t),o=32767&g,s=0;for(;s>>1;s++){const i=_.__digit(s),e=(g>>>15)-(32767&i)-n;n=1&e>>>15,this.__setDigit(t+s,(32767&e)<<15|32767&o),g=this.__digit(t+s+1),o=(32767&g)-(i>>>15)-n,n=1&o>>>15}const i=_.__digit(s),l=(g>>>15)-(32767&i)-n;n=1&l>>>15,this.__setDigit(t+s,(32767&l)<<15|32767&o);if(t+s+1>=this.length)throw new RangeError("out of bounds");0==(1&e)&&(g=this.__digit(t+s+1),o=(32767&g)-(i>>>15)-n,n=1&o>>>15,this.__setDigit(t+_.length,1073709056&g|32767&o))}else{t>>=1;let g=0;for(;g<_.length-1;g++){const i=this.__digit(t+g),e=_.__digit(g),o=(32767&i)-(32767&e)-n;n=1&o>>>15;const s=(i>>>15)-(e>>>15)-n;n=1&s>>>15,this.__setDigit(t+g,(32767&s)<<15|32767&o)}const i=this.__digit(t+g),o=_.__digit(g),s=(32767&i)-(32767&o)-n;n=1&s>>>15;let l=0;0==(1&e)&&(l=(i>>>15)-(o>>>15)-n,n=1&l>>>15),this.__setDigit(t+g,(32767&l)<<15|32767&s)}return n}__inplaceRightShift(_){if(0===_)return;let t=this.__digit(0)>>>_;const e=this.length-1;for(let n=0;n>>_}this.__setDigit(e,t)}static __specialLeftShift(_,t,e){const g=_.length,n=new o(g+e,!1);if(0===t){for(let t=0;t>>30-t}return 0t)throw new RangeError("BigInt too big");const e=0|t/30,n=t%30,g=_.length,s=0!==n&&0!=_.__digit(g-1)>>>30-n,l=g+e+(s?1:0),r=new o(l,_.sign);if(0===n){let t=0;for(;t>>30-n}if(s)r.__setDigit(g+e,t);else if(0!==t)throw new Error("implementation bug")}return r.__trim()}static __rightShiftByAbsolute(_,i){const t=_.length,e=_.sign,n=o.__toShiftAmount(i);if(0>n)return o.__rightShiftByMaximum(e);const g=0|n/30,s=n%30;let l=t-g;if(0>=l)return o.__rightShiftByMaximum(e);let r=!1;if(e){if(0!=(_.__digit(g)&(1<>>s;const n=t-g-1;for(let t=0;t>>s}a.__setDigit(n,e)}return r&&(a=o.__absoluteAddOne(a,!0,a)),a.__trim()}static __rightShiftByMaximum(i){return i?o.__oneDigit(1,!0):o.__zero()}static __toShiftAmount(i){if(1o.__kMaxLengthBits?-1:_}static __toPrimitive(i,_="default"){if("object"!=typeof i)return i;if(i.constructor===o)return i;if("undefined"!=typeof Symbol&&"symbol"==typeof Symbol.toPrimitive){const t=i[Symbol.toPrimitive];if(t){const i=t(_);if("object"!=typeof i)return i;throw new TypeError("Cannot convert object to primitive value")}}const t=i.valueOf;if(t){const _=t.call(i);if("object"!=typeof _)return _}const e=i.toString;if(e){const _=e.call(i);if("object"!=typeof _)return _}throw new TypeError("Cannot convert object to primitive value")}static __toNumeric(i){return o.__isBigInt(i)?i:+i}static __isBigInt(i){return"object"==typeof i&&null!==i&&i.constructor===o}static __truncateToNBits(i,_){const t=0|(i+29)/30,e=new o(t,_.sign),n=t-1;for(let t=0;t>>_}return e.__setDigit(n,g),e.__trim()}static __truncateAndSubFromPowerOfTwo(_,t,e){var n=Math.min;const g=0|(_+29)/30,s=new o(g,e);let l=0;const r=g-1;let a=0;for(const i=n(r,t.length);l>>30,s.__setDigit(l,1073741823&i)}for(;l>>i;const _=1<<32-i;h=_-u-a,h&=_-1}return s.__setDigit(r,h),s.__trim()}__digit(_){return this[_]}__unsignedDigit(_){return this[_]>>>0}__setDigit(_,i){this[_]=0|i}__setDigitGrow(_,i){this[_]=0|i}__halfDigitLength(){const i=this.length;return 32767>=this.__unsignedDigit(i-1)?2*i-1:2*i}__halfDigit(_){return 32767&this[_>>>1]>>>15*(1&_)}__setHalfDigit(_,i){const t=_>>>1,e=this.__digit(t),n=1&_?32767&e|i<<15:1073709056&e|32767&i;this.__setDigit(t,n)}static __digitPow(i,_){let t=1;for(;0<_;)1&_&&(t*=i),_>>>=1,i*=i;return t}static __isOneDigitInt(i){return(1073741823&i)===i}}return o.__kMaxLength=33554432,o.__kMaxLengthBits=o.__kMaxLength<<5,o.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],o.__kBitsPerCharTableShift=5,o.__kBitsPerCharTableMultiplier=1<>>0)/_)},o.__imul=i||function(i,_){return 0|i*_},o}); //# sourceMappingURL=jsbi-umd.js.map /***/ }), /***/ 42222: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var stub = __webpack_require__(63907); var parse = __webpack_require__(50542); var tracking = __webpack_require__(12478); var ls = 'localStorage' in __webpack_require__.g && __webpack_require__.g.localStorage ? __webpack_require__.g.localStorage : stub; function accessor (key, value) { if (arguments.length === 1) { return get(key); } return set(key, value); } function get (key) { const raw = ls.getItem(key); const parsed = parse(raw); return parsed; } function set (key, value) { try { ls.setItem(key, JSON.stringify(value)); return true; } catch (e) { return false; } } function remove (key) { return ls.removeItem(key); } function clear () { return ls.clear(); } function backend (store) { store && (ls = store); return ls; } accessor.set = set; accessor.get = get; accessor.remove = remove; accessor.clear = clear; accessor.backend = backend; accessor.on = tracking.on; accessor.off = tracking.off; module.exports = accessor; /***/ }), /***/ 50542: /***/ (function(module) { "use strict"; function parse (rawValue) { const parsed = parseValue(rawValue); if (parsed === undefined) { return null; } return parsed; } function parseValue (rawValue) { try { return JSON.parse(rawValue); } catch (err) { return rawValue; } } module.exports = parse; /***/ }), /***/ 63907: /***/ (function(module) { "use strict"; var ms = {}; function getItem (key) { return key in ms ? ms[key] : null; } function setItem (key, value) { ms[key] = value; return true; } function removeItem (key) { var found = key in ms; if (found) { return delete ms[key]; } return false; } function clear () { ms = {}; return true; } module.exports = { getItem: getItem, setItem: setItem, removeItem: removeItem, clear: clear }; /***/ }), /***/ 12478: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var parse = __webpack_require__(50542); var listeners = {}; var listening = false; function listen () { if (__webpack_require__.g.addEventListener) { __webpack_require__.g.addEventListener('storage', change, false); } else if (__webpack_require__.g.attachEvent) { __webpack_require__.g.attachEvent('onstorage', change); } else { __webpack_require__.g.onstorage = change; } } function change (e) { if (!e) { e = __webpack_require__.g.event; } var all = listeners[e.key]; if (all) { all.forEach(fire); } function fire (listener) { listener(parse(e.newValue), parse(e.oldValue), e.url || e.uri); } } function on (key, fn) { if (listeners[key]) { listeners[key].push(fn); } else { listeners[key] = [fn]; } if (listening === false) { listen(); } } function off (key, fn) { var ns = listeners[key]; if (ns.length > 1) { ns.splice(ns.indexOf(fn), 1); } else { listeners[key] = []; } } module.exports = { on: on, off: off }; /***/ }), /***/ 69483: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { /*! localForage -- Offline Storage, Improved Version 1.10.0 https://localforage.github.io/localForage (c) 2013-2017 Mozilla, Apache License 2.0 */ (function(f){if(true){module.exports=f()}else { var g; }})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=undefined;if(!u&&a)return require(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw (f.code="MODULE_NOT_FOUND", f)}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=undefined;for(var o=0;o element; its readystatechange event will be fired asynchronously once it is inserted // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called. var scriptEl = global.document.createElement('script'); scriptEl.onreadystatechange = function () { nextTick(); scriptEl.onreadystatechange = null; scriptEl.parentNode.removeChild(scriptEl); scriptEl = null; }; global.document.documentElement.appendChild(scriptEl); }; } else { scheduleDrain = function () { setTimeout(nextTick, 0); }; } } var draining; var queue = []; //named nextTick for less confusing stack traces function nextTick() { draining = true; var i, oldQueue; var len = queue.length; while (len) { oldQueue = queue; queue = []; i = -1; while (++i < len) { oldQueue[i](); } len = queue.length; } draining = false; } module.exports = immediate; function immediate(task) { if (queue.push(task) === 1 && !draining) { scheduleDrain(); } } }).call(this,typeof __webpack_require__.g !== "undefined" ? __webpack_require__.g : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],2:[function(_dereq_,module,exports){ 'use strict'; var immediate = _dereq_(1); /* istanbul ignore next */ function INTERNAL() {} var handlers = {}; var REJECTED = ['REJECTED']; var FULFILLED = ['FULFILLED']; var PENDING = ['PENDING']; module.exports = Promise; function Promise(resolver) { if (typeof resolver !== 'function') { throw new TypeError('resolver must be a function'); } this.state = PENDING; this.queue = []; this.outcome = void 0; if (resolver !== INTERNAL) { safelyResolveThenable(this, resolver); } } Promise.prototype["catch"] = function (onRejected) { return this.then(null, onRejected); }; Promise.prototype.then = function (onFulfilled, onRejected) { if (typeof onFulfilled !== 'function' && this.state === FULFILLED || typeof onRejected !== 'function' && this.state === REJECTED) { return this; } var promise = new this.constructor(INTERNAL); if (this.state !== PENDING) { var resolver = this.state === FULFILLED ? onFulfilled : onRejected; unwrap(promise, resolver, this.outcome); } else { this.queue.push(new QueueItem(promise, onFulfilled, onRejected)); } return promise; }; function QueueItem(promise, onFulfilled, onRejected) { this.promise = promise; if (typeof onFulfilled === 'function') { this.onFulfilled = onFulfilled; this.callFulfilled = this.otherCallFulfilled; } if (typeof onRejected === 'function') { this.onRejected = onRejected; this.callRejected = this.otherCallRejected; } } QueueItem.prototype.callFulfilled = function (value) { handlers.resolve(this.promise, value); }; QueueItem.prototype.otherCallFulfilled = function (value) { unwrap(this.promise, this.onFulfilled, value); }; QueueItem.prototype.callRejected = function (value) { handlers.reject(this.promise, value); }; QueueItem.prototype.otherCallRejected = function (value) { unwrap(this.promise, this.onRejected, value); }; function unwrap(promise, func, value) { immediate(function () { var returnValue; try { returnValue = func(value); } catch (e) { return handlers.reject(promise, e); } if (returnValue === promise) { handlers.reject(promise, new TypeError('Cannot resolve promise with itself')); } else { handlers.resolve(promise, returnValue); } }); } handlers.resolve = function (self, value) { var result = tryCatch(getThen, value); if (result.status === 'error') { return handlers.reject(self, result.value); } var thenable = result.value; if (thenable) { safelyResolveThenable(self, thenable); } else { self.state = FULFILLED; self.outcome = value; var i = -1; var len = self.queue.length; while (++i < len) { self.queue[i].callFulfilled(value); } } return self; }; handlers.reject = function (self, error) { self.state = REJECTED; self.outcome = error; var i = -1; var len = self.queue.length; while (++i < len) { self.queue[i].callRejected(error); } return self; }; function getThen(obj) { // Make sure we only access the accessor once as required by the spec var then = obj && obj.then; if (obj && (typeof obj === 'object' || typeof obj === 'function') && typeof then === 'function') { return function appyThen() { then.apply(obj, arguments); }; } } function safelyResolveThenable(self, thenable) { // Either fulfill, reject or reject with error var called = false; function onError(value) { if (called) { return; } called = true; handlers.reject(self, value); } function onSuccess(value) { if (called) { return; } called = true; handlers.resolve(self, value); } function tryToUnwrap() { thenable(onSuccess, onError); } var result = tryCatch(tryToUnwrap); if (result.status === 'error') { onError(result.value); } } function tryCatch(func, value) { var out = {}; try { out.value = func(value); out.status = 'success'; } catch (e) { out.status = 'error'; out.value = e; } return out; } Promise.resolve = resolve; function resolve(value) { if (value instanceof this) { return value; } return handlers.resolve(new this(INTERNAL), value); } Promise.reject = reject; function reject(reason) { var promise = new this(INTERNAL); return handlers.reject(promise, reason); } Promise.all = all; function all(iterable) { var self = this; if (Object.prototype.toString.call(iterable) !== '[object Array]') { return this.reject(new TypeError('must be an array')); } var len = iterable.length; var called = false; if (!len) { return this.resolve([]); } var values = new Array(len); var resolved = 0; var i = -1; var promise = new this(INTERNAL); while (++i < len) { allResolver(iterable[i], i); } return promise; function allResolver(value, i) { self.resolve(value).then(resolveFromAll, function (error) { if (!called) { called = true; handlers.reject(promise, error); } }); function resolveFromAll(outValue) { values[i] = outValue; if (++resolved === len && !called) { called = true; handlers.resolve(promise, values); } } } } Promise.race = race; function race(iterable) { var self = this; if (Object.prototype.toString.call(iterable) !== '[object Array]') { return this.reject(new TypeError('must be an array')); } var len = iterable.length; var called = false; if (!len) { return this.resolve([]); } var i = -1; var promise = new this(INTERNAL); while (++i < len) { resolver(iterable[i]); } return promise; function resolver(value) { self.resolve(value).then(function (response) { if (!called) { called = true; handlers.resolve(promise, response); } }, function (error) { if (!called) { called = true; handlers.reject(promise, error); } }); } } },{"1":1}],3:[function(_dereq_,module,exports){ (function (global){ 'use strict'; if (typeof global.Promise !== 'function') { global.Promise = _dereq_(2); } }).call(this,typeof __webpack_require__.g !== "undefined" ? __webpack_require__.g : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"2":2}],4:[function(_dereq_,module,exports){ 'use strict'; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function getIDB() { /* global indexedDB,webkitIndexedDB,mozIndexedDB,OIndexedDB,msIndexedDB */ try { if (typeof indexedDB !== 'undefined') { return indexedDB; } if (typeof webkitIndexedDB !== 'undefined') { return webkitIndexedDB; } if (typeof mozIndexedDB !== 'undefined') { return mozIndexedDB; } if (typeof OIndexedDB !== 'undefined') { return OIndexedDB; } if (typeof msIndexedDB !== 'undefined') { return msIndexedDB; } } catch (e) { return; } } var idb = getIDB(); function isIndexedDBValid() { try { // Initialize IndexedDB; fall back to vendor-prefixed versions // if needed. if (!idb || !idb.open) { return false; } // We mimic PouchDB here; // // We test for openDatabase because IE Mobile identifies itself // as Safari. Oh the lulz... var isSafari = typeof openDatabase !== 'undefined' && /(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent) && !/BlackBerry/.test(navigator.platform); var hasFetch = typeof fetch === 'function' && fetch.toString().indexOf('[native code') !== -1; // Safari <10.1 does not meet our requirements for IDB support // (see: https://github.com/pouchdb/pouchdb/issues/5572). // Safari 10.1 shipped with fetch, we can use that to detect it. // Note: this creates issues with `window.fetch` polyfills and // overrides; see: // https://github.com/localForage/localForage/issues/856 return (!isSafari || hasFetch) && typeof indexedDB !== 'undefined' && // some outdated implementations of IDB that appear on Samsung // and HTC Android devices <4.4 are missing IDBKeyRange // See: https://github.com/mozilla/localForage/issues/128 // See: https://github.com/mozilla/localForage/issues/272 typeof IDBKeyRange !== 'undefined'; } catch (e) { return false; } } // Abstracts constructing a Blob object, so it also works in older // browsers that don't support the native Blob constructor. (i.e. // old QtWebKit versions, at least). // Abstracts constructing a Blob object, so it also works in older // browsers that don't support the native Blob constructor. (i.e. // old QtWebKit versions, at least). function createBlob(parts, properties) { /* global BlobBuilder,MSBlobBuilder,MozBlobBuilder,WebKitBlobBuilder */ parts = parts || []; properties = properties || {}; try { return new Blob(parts, properties); } catch (e) { if (e.name !== 'TypeError') { throw e; } var Builder = typeof BlobBuilder !== 'undefined' ? BlobBuilder : typeof MSBlobBuilder !== 'undefined' ? MSBlobBuilder : typeof MozBlobBuilder !== 'undefined' ? MozBlobBuilder : WebKitBlobBuilder; var builder = new Builder(); for (var i = 0; i < parts.length; i += 1) { builder.append(parts[i]); } return builder.getBlob(properties.type); } } // This is CommonJS because lie is an external dependency, so Rollup // can just ignore it. if (typeof Promise === 'undefined') { // In the "nopromises" build this will just throw if you don't have // a global promise object, but it would throw anyway later. _dereq_(3); } var Promise$1 = Promise; function executeCallback(promise, callback) { if (callback) { promise.then(function (result) { callback(null, result); }, function (error) { callback(error); }); } } function executeTwoCallbacks(promise, callback, errorCallback) { if (typeof callback === 'function') { promise.then(callback); } if (typeof errorCallback === 'function') { promise["catch"](errorCallback); } } function normalizeKey(key) { // Cast the key to a string, as that's all we can set as a key. if (typeof key !== 'string') { console.warn(key + ' used as a key, but it is not a string.'); key = String(key); } return key; } function getCallback() { if (arguments.length && typeof arguments[arguments.length - 1] === 'function') { return arguments[arguments.length - 1]; } } // Some code originally from async_storage.js in // [Gaia](https://github.com/mozilla-b2g/gaia). var DETECT_BLOB_SUPPORT_STORE = 'local-forage-detect-blob-support'; var supportsBlobs = void 0; var dbContexts = {}; var toString = Object.prototype.toString; // Transaction Modes var READ_ONLY = 'readonly'; var READ_WRITE = 'readwrite'; // Transform a binary string to an array buffer, because otherwise // weird stuff happens when you try to work with the binary string directly. // It is known. // From http://stackoverflow.com/questions/14967647/ (continues on next line) // encode-decode-image-with-base64-breaks-image (2013-04-21) function _binStringToArrayBuffer(bin) { var length = bin.length; var buf = new ArrayBuffer(length); var arr = new Uint8Array(buf); for (var i = 0; i < length; i++) { arr[i] = bin.charCodeAt(i); } return buf; } // // Blobs are not supported in all versions of IndexedDB, notably // Chrome <37 and Android <5. In those versions, storing a blob will throw. // // Various other blob bugs exist in Chrome v37-42 (inclusive). // Detecting them is expensive and confusing to users, and Chrome 37-42 // is at very low usage worldwide, so we do a hacky userAgent check instead. // // content-type bug: https://code.google.com/p/chromium/issues/detail?id=408120 // 404 bug: https://code.google.com/p/chromium/issues/detail?id=447916 // FileReader bug: https://code.google.com/p/chromium/issues/detail?id=447836 // // Code borrowed from PouchDB. See: // https://github.com/pouchdb/pouchdb/blob/master/packages/node_modules/pouchdb-adapter-idb/src/blobSupport.js // function _checkBlobSupportWithoutCaching(idb) { return new Promise$1(function (resolve) { var txn = idb.transaction(DETECT_BLOB_SUPPORT_STORE, READ_WRITE); var blob = createBlob(['']); txn.objectStore(DETECT_BLOB_SUPPORT_STORE).put(blob, 'key'); txn.onabort = function (e) { // If the transaction aborts now its due to not being able to // write to the database, likely due to the disk being full e.preventDefault(); e.stopPropagation(); resolve(false); }; txn.oncomplete = function () { var matchedChrome = navigator.userAgent.match(/Chrome\/(\d+)/); var matchedEdge = navigator.userAgent.match(/Edge\//); // MS Edge pretends to be Chrome 42: // https://msdn.microsoft.com/en-us/library/hh869301%28v=vs.85%29.aspx resolve(matchedEdge || !matchedChrome || parseInt(matchedChrome[1], 10) >= 43); }; })["catch"](function () { return false; // error, so assume unsupported }); } function _checkBlobSupport(idb) { if (typeof supportsBlobs === 'boolean') { return Promise$1.resolve(supportsBlobs); } return _checkBlobSupportWithoutCaching(idb).then(function (value) { supportsBlobs = value; return supportsBlobs; }); } function _deferReadiness(dbInfo) { var dbContext = dbContexts[dbInfo.name]; // Create a deferred object representing the current database operation. var deferredOperation = {}; deferredOperation.promise = new Promise$1(function (resolve, reject) { deferredOperation.resolve = resolve; deferredOperation.reject = reject; }); // Enqueue the deferred operation. dbContext.deferredOperations.push(deferredOperation); // Chain its promise to the database readiness. if (!dbContext.dbReady) { dbContext.dbReady = deferredOperation.promise; } else { dbContext.dbReady = dbContext.dbReady.then(function () { return deferredOperation.promise; }); } } function _advanceReadiness(dbInfo) { var dbContext = dbContexts[dbInfo.name]; // Dequeue a deferred operation. var deferredOperation = dbContext.deferredOperations.pop(); // Resolve its promise (which is part of the database readiness // chain of promises). if (deferredOperation) { deferredOperation.resolve(); return deferredOperation.promise; } } function _rejectReadiness(dbInfo, err) { var dbContext = dbContexts[dbInfo.name]; // Dequeue a deferred operation. var deferredOperation = dbContext.deferredOperations.pop(); // Reject its promise (which is part of the database readiness // chain of promises). if (deferredOperation) { deferredOperation.reject(err); return deferredOperation.promise; } } function _getConnection(dbInfo, upgradeNeeded) { return new Promise$1(function (resolve, reject) { dbContexts[dbInfo.name] = dbContexts[dbInfo.name] || createDbContext(); if (dbInfo.db) { if (upgradeNeeded) { _deferReadiness(dbInfo); dbInfo.db.close(); } else { return resolve(dbInfo.db); } } var dbArgs = [dbInfo.name]; if (upgradeNeeded) { dbArgs.push(dbInfo.version); } var openreq = idb.open.apply(idb, dbArgs); if (upgradeNeeded) { openreq.onupgradeneeded = function (e) { var db = openreq.result; try { db.createObjectStore(dbInfo.storeName); if (e.oldVersion <= 1) { // Added when support for blob shims was added db.createObjectStore(DETECT_BLOB_SUPPORT_STORE); } } catch (ex) { if (ex.name === 'ConstraintError') { console.warn('The database "' + dbInfo.name + '"' + ' has been upgraded from version ' + e.oldVersion + ' to version ' + e.newVersion + ', but the storage "' + dbInfo.storeName + '" already exists.'); } else { throw ex; } } }; } openreq.onerror = function (e) { e.preventDefault(); reject(openreq.error); }; openreq.onsuccess = function () { var db = openreq.result; db.onversionchange = function (e) { // Triggered when the database is modified (e.g. adding an objectStore) or // deleted (even when initiated by other sessions in different tabs). // Closing the connection here prevents those operations from being blocked. // If the database is accessed again later by this instance, the connection // will be reopened or the database recreated as needed. e.target.close(); }; resolve(db); _advanceReadiness(dbInfo); }; }); } function _getOriginalConnection(dbInfo) { return _getConnection(dbInfo, false); } function _getUpgradedConnection(dbInfo) { return _getConnection(dbInfo, true); } function _isUpgradeNeeded(dbInfo, defaultVersion) { if (!dbInfo.db) { return true; } var isNewStore = !dbInfo.db.objectStoreNames.contains(dbInfo.storeName); var isDowngrade = dbInfo.version < dbInfo.db.version; var isUpgrade = dbInfo.version > dbInfo.db.version; if (isDowngrade) { // If the version is not the default one // then warn for impossible downgrade. if (dbInfo.version !== defaultVersion) { console.warn('The database "' + dbInfo.name + '"' + " can't be downgraded from version " + dbInfo.db.version + ' to version ' + dbInfo.version + '.'); } // Align the versions to prevent errors. dbInfo.version = dbInfo.db.version; } if (isUpgrade || isNewStore) { // If the store is new then increment the version (if needed). // This will trigger an "upgradeneeded" event which is required // for creating a store. if (isNewStore) { var incVersion = dbInfo.db.version + 1; if (incVersion > dbInfo.version) { dbInfo.version = incVersion; } } return true; } return false; } // encode a blob for indexeddb engines that don't support blobs function _encodeBlob(blob) { return new Promise$1(function (resolve, reject) { var reader = new FileReader(); reader.onerror = reject; reader.onloadend = function (e) { var base64 = btoa(e.target.result || ''); resolve({ __local_forage_encoded_blob: true, data: base64, type: blob.type }); }; reader.readAsBinaryString(blob); }); } // decode an encoded blob function _decodeBlob(encodedBlob) { var arrayBuff = _binStringToArrayBuffer(atob(encodedBlob.data)); return createBlob([arrayBuff], { type: encodedBlob.type }); } // is this one of our fancy encoded blobs? function _isEncodedBlob(value) { return value && value.__local_forage_encoded_blob; } // Specialize the default `ready()` function by making it dependent // on the current database operations. Thus, the driver will be actually // ready when it's been initialized (default) *and* there are no pending // operations on the database (initiated by some other instances). function _fullyReady(callback) { var self = this; var promise = self._initReady().then(function () { var dbContext = dbContexts[self._dbInfo.name]; if (dbContext && dbContext.dbReady) { return dbContext.dbReady; } }); executeTwoCallbacks(promise, callback, callback); return promise; } // Try to establish a new db connection to replace the // current one which is broken (i.e. experiencing // InvalidStateError while creating a transaction). function _tryReconnect(dbInfo) { _deferReadiness(dbInfo); var dbContext = dbContexts[dbInfo.name]; var forages = dbContext.forages; for (var i = 0; i < forages.length; i++) { var forage = forages[i]; if (forage._dbInfo.db) { forage._dbInfo.db.close(); forage._dbInfo.db = null; } } dbInfo.db = null; return _getOriginalConnection(dbInfo).then(function (db) { dbInfo.db = db; if (_isUpgradeNeeded(dbInfo)) { // Reopen the database for upgrading. return _getUpgradedConnection(dbInfo); } return db; }).then(function (db) { // store the latest db reference // in case the db was upgraded dbInfo.db = dbContext.db = db; for (var i = 0; i < forages.length; i++) { forages[i]._dbInfo.db = db; } })["catch"](function (err) { _rejectReadiness(dbInfo, err); throw err; }); } // FF doesn't like Promises (micro-tasks) and IDDB store operations, // so we have to do it with callbacks function createTransaction(dbInfo, mode, callback, retries) { if (retries === undefined) { retries = 1; } try { var tx = dbInfo.db.transaction(dbInfo.storeName, mode); callback(null, tx); } catch (err) { if (retries > 0 && (!dbInfo.db || err.name === 'InvalidStateError' || err.name === 'NotFoundError')) { return Promise$1.resolve().then(function () { if (!dbInfo.db || err.name === 'NotFoundError' && !dbInfo.db.objectStoreNames.contains(dbInfo.storeName) && dbInfo.version <= dbInfo.db.version) { // increase the db version, to create the new ObjectStore if (dbInfo.db) { dbInfo.version = dbInfo.db.version + 1; } // Reopen the database for upgrading. return _getUpgradedConnection(dbInfo); } }).then(function () { return _tryReconnect(dbInfo).then(function () { createTransaction(dbInfo, mode, callback, retries - 1); }); })["catch"](callback); } callback(err); } } function createDbContext() { return { // Running localForages sharing a database. forages: [], // Shared database. db: null, // Database readiness (promise). dbReady: null, // Deferred operations on the database. deferredOperations: [] }; } // Open the IndexedDB database (automatically creates one if one didn't // previously exist), using any options set in the config. function _initStorage(options) { var self = this; var dbInfo = { db: null }; if (options) { for (var i in options) { dbInfo[i] = options[i]; } } // Get the current context of the database; var dbContext = dbContexts[dbInfo.name]; // ...or create a new context. if (!dbContext) { dbContext = createDbContext(); // Register the new context in the global container. dbContexts[dbInfo.name] = dbContext; } // Register itself as a running localForage in the current context. dbContext.forages.push(self); // Replace the default `ready()` function with the specialized one. if (!self._initReady) { self._initReady = self.ready; self.ready = _fullyReady; } // Create an array of initialization states of the related localForages. var initPromises = []; function ignoreErrors() { // Don't handle errors here, // just makes sure related localForages aren't pending. return Promise$1.resolve(); } for (var j = 0; j < dbContext.forages.length; j++) { var forage = dbContext.forages[j]; if (forage !== self) { // Don't wait for itself... initPromises.push(forage._initReady()["catch"](ignoreErrors)); } } // Take a snapshot of the related localForages. var forages = dbContext.forages.slice(0); // Initialize the connection process only when // all the related localForages aren't pending. return Promise$1.all(initPromises).then(function () { dbInfo.db = dbContext.db; // Get the connection or open a new one without upgrade. return _getOriginalConnection(dbInfo); }).then(function (db) { dbInfo.db = db; if (_isUpgradeNeeded(dbInfo, self._defaultConfig.version)) { // Reopen the database for upgrading. return _getUpgradedConnection(dbInfo); } return db; }).then(function (db) { dbInfo.db = dbContext.db = db; self._dbInfo = dbInfo; // Share the final connection amongst related localForages. for (var k = 0; k < forages.length; k++) { var forage = forages[k]; if (forage !== self) { // Self is already up-to-date. forage._dbInfo.db = dbInfo.db; forage._dbInfo.version = dbInfo.version; } } }); } function getItem(key, callback) { var self = this; key = normalizeKey(key); var promise = new Promise$1(function (resolve, reject) { self.ready().then(function () { createTransaction(self._dbInfo, READ_ONLY, function (err, transaction) { if (err) { return reject(err); } try { var store = transaction.objectStore(self._dbInfo.storeName); var req = store.get(key); req.onsuccess = function () { var value = req.result; if (value === undefined) { value = null; } if (_isEncodedBlob(value)) { value = _decodeBlob(value); } resolve(value); }; req.onerror = function () { reject(req.error); }; } catch (e) { reject(e); } }); })["catch"](reject); }); executeCallback(promise, callback); return promise; } // Iterate over all items stored in database. function iterate(iterator, callback) { var self = this; var promise = new Promise$1(function (resolve, reject) { self.ready().then(function () { createTransaction(self._dbInfo, READ_ONLY, function (err, transaction) { if (err) { return reject(err); } try { var store = transaction.objectStore(self._dbInfo.storeName); var req = store.openCursor(); var iterationNumber = 1; req.onsuccess = function () { var cursor = req.result; if (cursor) { var value = cursor.value; if (_isEncodedBlob(value)) { value = _decodeBlob(value); } var result = iterator(value, cursor.key, iterationNumber++); // when the iterator callback returns any // (non-`undefined`) value, then we stop // the iteration immediately if (result !== void 0) { resolve(result); } else { cursor["continue"](); } } else { resolve(); } }; req.onerror = function () { reject(req.error); }; } catch (e) { reject(e); } }); })["catch"](reject); }); executeCallback(promise, callback); return promise; } function setItem(key, value, callback) { var self = this; key = normalizeKey(key); var promise = new Promise$1(function (resolve, reject) { var dbInfo; self.ready().then(function () { dbInfo = self._dbInfo; if (toString.call(value) === '[object Blob]') { return _checkBlobSupport(dbInfo.db).then(function (blobSupport) { if (blobSupport) { return value; } return _encodeBlob(value); }); } return value; }).then(function (value) { createTransaction(self._dbInfo, READ_WRITE, function (err, transaction) { if (err) { return reject(err); } try { var store = transaction.objectStore(self._dbInfo.storeName); // The reason we don't _save_ null is because IE 10 does // not support saving the `null` type in IndexedDB. How // ironic, given the bug below! // See: https://github.com/mozilla/localForage/issues/161 if (value === null) { value = undefined; } var req = store.put(value, key); transaction.oncomplete = function () { // Cast to undefined so the value passed to // callback/promise is the same as what one would get out // of `getItem()` later. This leads to some weirdness // (setItem('foo', undefined) will return `null`), but // it's not my fault localStorage is our baseline and that // it's weird. if (value === undefined) { value = null; } resolve(value); }; transaction.onabort = transaction.onerror = function () { var err = req.error ? req.error : req.transaction.error; reject(err); }; } catch (e) { reject(e); } }); })["catch"](reject); }); executeCallback(promise, callback); return promise; } function removeItem(key, callback) { var self = this; key = normalizeKey(key); var promise = new Promise$1(function (resolve, reject) { self.ready().then(function () { createTransaction(self._dbInfo, READ_WRITE, function (err, transaction) { if (err) { return reject(err); } try { var store = transaction.objectStore(self._dbInfo.storeName); // We use a Grunt task to make this safe for IE and some // versions of Android (including those used by Cordova). // Normally IE won't like `.delete()` and will insist on // using `['delete']()`, but we have a build step that // fixes this for us now. var req = store["delete"](key); transaction.oncomplete = function () { resolve(); }; transaction.onerror = function () { reject(req.error); }; // The request will be also be aborted if we've exceeded our storage // space. transaction.onabort = function () { var err = req.error ? req.error : req.transaction.error; reject(err); }; } catch (e) { reject(e); } }); })["catch"](reject); }); executeCallback(promise, callback); return promise; } function clear(callback) { var self = this; var promise = new Promise$1(function (resolve, reject) { self.ready().then(function () { createTransaction(self._dbInfo, READ_WRITE, function (err, transaction) { if (err) { return reject(err); } try { var store = transaction.objectStore(self._dbInfo.storeName); var req = store.clear(); transaction.oncomplete = function () { resolve(); }; transaction.onabort = transaction.onerror = function () { var err = req.error ? req.error : req.transaction.error; reject(err); }; } catch (e) { reject(e); } }); })["catch"](reject); }); executeCallback(promise, callback); return promise; } function length(callback) { var self = this; var promise = new Promise$1(function (resolve, reject) { self.ready().then(function () { createTransaction(self._dbInfo, READ_ONLY, function (err, transaction) { if (err) { return reject(err); } try { var store = transaction.objectStore(self._dbInfo.storeName); var req = store.count(); req.onsuccess = function () { resolve(req.result); }; req.onerror = function () { reject(req.error); }; } catch (e) { reject(e); } }); })["catch"](reject); }); executeCallback(promise, callback); return promise; } function key(n, callback) { var self = this; var promise = new Promise$1(function (resolve, reject) { if (n < 0) { resolve(null); return; } self.ready().then(function () { createTransaction(self._dbInfo, READ_ONLY, function (err, transaction) { if (err) { return reject(err); } try { var store = transaction.objectStore(self._dbInfo.storeName); var advanced = false; var req = store.openKeyCursor(); req.onsuccess = function () { var cursor = req.result; if (!cursor) { // this means there weren't enough keys resolve(null); return; } if (n === 0) { // We have the first key, return it if that's what they // wanted. resolve(cursor.key); } else { if (!advanced) { // Otherwise, ask the cursor to skip ahead n // records. advanced = true; cursor.advance(n); } else { // When we get here, we've got the nth key. resolve(cursor.key); } } }; req.onerror = function () { reject(req.error); }; } catch (e) { reject(e); } }); })["catch"](reject); }); executeCallback(promise, callback); return promise; } function keys(callback) { var self = this; var promise = new Promise$1(function (resolve, reject) { self.ready().then(function () { createTransaction(self._dbInfo, READ_ONLY, function (err, transaction) { if (err) { return reject(err); } try { var store = transaction.objectStore(self._dbInfo.storeName); var req = store.openKeyCursor(); var keys = []; req.onsuccess = function () { var cursor = req.result; if (!cursor) { resolve(keys); return; } keys.push(cursor.key); cursor["continue"](); }; req.onerror = function () { reject(req.error); }; } catch (e) { reject(e); } }); })["catch"](reject); }); executeCallback(promise, callback); return promise; } function dropInstance(options, callback) { callback = getCallback.apply(this, arguments); var currentConfig = this.config(); options = typeof options !== 'function' && options || {}; if (!options.name) { options.name = options.name || currentConfig.name; options.storeName = options.storeName || currentConfig.storeName; } var self = this; var promise; if (!options.name) { promise = Promise$1.reject('Invalid arguments'); } else { var isCurrentDb = options.name === currentConfig.name && self._dbInfo.db; var dbPromise = isCurrentDb ? Promise$1.resolve(self._dbInfo.db) : _getOriginalConnection(options).then(function (db) { var dbContext = dbContexts[options.name]; var forages = dbContext.forages; dbContext.db = db; for (var i = 0; i < forages.length; i++) { forages[i]._dbInfo.db = db; } return db; }); if (!options.storeName) { promise = dbPromise.then(function (db) { _deferReadiness(options); var dbContext = dbContexts[options.name]; var forages = dbContext.forages; db.close(); for (var i = 0; i < forages.length; i++) { var forage = forages[i]; forage._dbInfo.db = null; } var dropDBPromise = new Promise$1(function (resolve, reject) { var req = idb.deleteDatabase(options.name); req.onerror = function () { var db = req.result; if (db) { db.close(); } reject(req.error); }; req.onblocked = function () { // Closing all open connections in onversionchange handler should prevent this situation, but if // we do get here, it just means the request remains pending - eventually it will succeed or error console.warn('dropInstance blocked for database "' + options.name + '" until all open connections are closed'); }; req.onsuccess = function () { var db = req.result; if (db) { db.close(); } resolve(db); }; }); return dropDBPromise.then(function (db) { dbContext.db = db; for (var i = 0; i < forages.length; i++) { var _forage = forages[i]; _advanceReadiness(_forage._dbInfo); } })["catch"](function (err) { (_rejectReadiness(options, err) || Promise$1.resolve())["catch"](function () {}); throw err; }); }); } else { promise = dbPromise.then(function (db) { if (!db.objectStoreNames.contains(options.storeName)) { return; } var newVersion = db.version + 1; _deferReadiness(options); var dbContext = dbContexts[options.name]; var forages = dbContext.forages; db.close(); for (var i = 0; i < forages.length; i++) { var forage = forages[i]; forage._dbInfo.db = null; forage._dbInfo.version = newVersion; } var dropObjectPromise = new Promise$1(function (resolve, reject) { var req = idb.open(options.name, newVersion); req.onerror = function (err) { var db = req.result; db.close(); reject(err); }; req.onupgradeneeded = function () { var db = req.result; db.deleteObjectStore(options.storeName); }; req.onsuccess = function () { var db = req.result; db.close(); resolve(db); }; }); return dropObjectPromise.then(function (db) { dbContext.db = db; for (var j = 0; j < forages.length; j++) { var _forage2 = forages[j]; _forage2._dbInfo.db = db; _advanceReadiness(_forage2._dbInfo); } })["catch"](function (err) { (_rejectReadiness(options, err) || Promise$1.resolve())["catch"](function () {}); throw err; }); }); } } executeCallback(promise, callback); return promise; } var asyncStorage = { _driver: 'asyncStorage', _initStorage: _initStorage, _support: isIndexedDBValid(), iterate: iterate, getItem: getItem, setItem: setItem, removeItem: removeItem, clear: clear, length: length, key: key, keys: keys, dropInstance: dropInstance }; function isWebSQLValid() { return typeof openDatabase === 'function'; } // Sadly, the best way to save binary data in WebSQL/localStorage is serializing // it to Base64, so this is how we store it to prevent very strange errors with less // verbose ways of binary <-> string data storage. var BASE_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; var BLOB_TYPE_PREFIX = '~~local_forage_type~'; var BLOB_TYPE_PREFIX_REGEX = /^~~local_forage_type~([^~]+)~/; var SERIALIZED_MARKER = '__lfsc__:'; var SERIALIZED_MARKER_LENGTH = SERIALIZED_MARKER.length; // OMG the serializations! var TYPE_ARRAYBUFFER = 'arbf'; var TYPE_BLOB = 'blob'; var TYPE_INT8ARRAY = 'si08'; var TYPE_UINT8ARRAY = 'ui08'; var TYPE_UINT8CLAMPEDARRAY = 'uic8'; var TYPE_INT16ARRAY = 'si16'; var TYPE_INT32ARRAY = 'si32'; var TYPE_UINT16ARRAY = 'ur16'; var TYPE_UINT32ARRAY = 'ui32'; var TYPE_FLOAT32ARRAY = 'fl32'; var TYPE_FLOAT64ARRAY = 'fl64'; var TYPE_SERIALIZED_MARKER_LENGTH = SERIALIZED_MARKER_LENGTH + TYPE_ARRAYBUFFER.length; var toString$1 = Object.prototype.toString; function stringToBuffer(serializedString) { // Fill the string into a ArrayBuffer. var bufferLength = serializedString.length * 0.75; var len = serializedString.length; var i; var p = 0; var encoded1, encoded2, encoded3, encoded4; if (serializedString[serializedString.length - 1] === '=') { bufferLength--; if (serializedString[serializedString.length - 2] === '=') { bufferLength--; } } var buffer = new ArrayBuffer(bufferLength); var bytes = new Uint8Array(buffer); for (i = 0; i < len; i += 4) { encoded1 = BASE_CHARS.indexOf(serializedString[i]); encoded2 = BASE_CHARS.indexOf(serializedString[i + 1]); encoded3 = BASE_CHARS.indexOf(serializedString[i + 2]); encoded4 = BASE_CHARS.indexOf(serializedString[i + 3]); /*jslint bitwise: true */ bytes[p++] = encoded1 << 2 | encoded2 >> 4; bytes[p++] = (encoded2 & 15) << 4 | encoded3 >> 2; bytes[p++] = (encoded3 & 3) << 6 | encoded4 & 63; } return buffer; } // Converts a buffer to a string to store, serialized, in the backend // storage library. function bufferToString(buffer) { // base64-arraybuffer var bytes = new Uint8Array(buffer); var base64String = ''; var i; for (i = 0; i < bytes.length; i += 3) { /*jslint bitwise: true */ base64String += BASE_CHARS[bytes[i] >> 2]; base64String += BASE_CHARS[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4]; base64String += BASE_CHARS[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6]; base64String += BASE_CHARS[bytes[i + 2] & 63]; } if (bytes.length % 3 === 2) { base64String = base64String.substring(0, base64String.length - 1) + '='; } else if (bytes.length % 3 === 1) { base64String = base64String.substring(0, base64String.length - 2) + '=='; } return base64String; } // Serialize a value, afterwards executing a callback (which usually // instructs the `setItem()` callback/promise to be executed). This is how // we store binary data with localStorage. function serialize(value, callback) { var valueType = ''; if (value) { valueType = toString$1.call(value); } // Cannot use `value instanceof ArrayBuffer` or such here, as these // checks fail when running the tests using casper.js... // // TODO: See why those tests fail and use a better solution. if (value && (valueType === '[object ArrayBuffer]' || value.buffer && toString$1.call(value.buffer) === '[object ArrayBuffer]')) { // Convert binary arrays to a string and prefix the string with // a special marker. var buffer; var marker = SERIALIZED_MARKER; if (value instanceof ArrayBuffer) { buffer = value; marker += TYPE_ARRAYBUFFER; } else { buffer = value.buffer; if (valueType === '[object Int8Array]') { marker += TYPE_INT8ARRAY; } else if (valueType === '[object Uint8Array]') { marker += TYPE_UINT8ARRAY; } else if (valueType === '[object Uint8ClampedArray]') { marker += TYPE_UINT8CLAMPEDARRAY; } else if (valueType === '[object Int16Array]') { marker += TYPE_INT16ARRAY; } else if (valueType === '[object Uint16Array]') { marker += TYPE_UINT16ARRAY; } else if (valueType === '[object Int32Array]') { marker += TYPE_INT32ARRAY; } else if (valueType === '[object Uint32Array]') { marker += TYPE_UINT32ARRAY; } else if (valueType === '[object Float32Array]') { marker += TYPE_FLOAT32ARRAY; } else if (valueType === '[object Float64Array]') { marker += TYPE_FLOAT64ARRAY; } else { callback(new Error('Failed to get type for BinaryArray')); } } callback(marker + bufferToString(buffer)); } else if (valueType === '[object Blob]') { // Conver the blob to a binaryArray and then to a string. var fileReader = new FileReader(); fileReader.onload = function () { // Backwards-compatible prefix for the blob type. var str = BLOB_TYPE_PREFIX + value.type + '~' + bufferToString(this.result); callback(SERIALIZED_MARKER + TYPE_BLOB + str); }; fileReader.readAsArrayBuffer(value); } else { try { callback(JSON.stringify(value)); } catch (e) { console.error("Couldn't convert value into a JSON string: ", value); callback(null, e); } } } // Deserialize data we've inserted into a value column/field. We place // special markers into our strings to mark them as encoded; this isn't // as nice as a meta field, but it's the only sane thing we can do whilst // keeping localStorage support intact. // // Oftentimes this will just deserialize JSON content, but if we have a // special marker (SERIALIZED_MARKER, defined above), we will extract // some kind of arraybuffer/binary data/typed array out of the string. function deserialize(value) { // If we haven't marked this string as being specially serialized (i.e. // something other than serialized JSON), we can just return it and be // done with it. if (value.substring(0, SERIALIZED_MARKER_LENGTH) !== SERIALIZED_MARKER) { return JSON.parse(value); } // The following code deals with deserializing some kind of Blob or // TypedArray. First we separate out the type of data we're dealing // with from the data itself. var serializedString = value.substring(TYPE_SERIALIZED_MARKER_LENGTH); var type = value.substring(SERIALIZED_MARKER_LENGTH, TYPE_SERIALIZED_MARKER_LENGTH); var blobType; // Backwards-compatible blob type serialization strategy. // DBs created with older versions of localForage will simply not have the blob type. if (type === TYPE_BLOB && BLOB_TYPE_PREFIX_REGEX.test(serializedString)) { var matcher = serializedString.match(BLOB_TYPE_PREFIX_REGEX); blobType = matcher[1]; serializedString = serializedString.substring(matcher[0].length); } var buffer = stringToBuffer(serializedString); // Return the right type based on the code/type set during // serialization. switch (type) { case TYPE_ARRAYBUFFER: return buffer; case TYPE_BLOB: return createBlob([buffer], { type: blobType }); case TYPE_INT8ARRAY: return new Int8Array(buffer); case TYPE_UINT8ARRAY: return new Uint8Array(buffer); case TYPE_UINT8CLAMPEDARRAY: return new Uint8ClampedArray(buffer); case TYPE_INT16ARRAY: return new Int16Array(buffer); case TYPE_UINT16ARRAY: return new Uint16Array(buffer); case TYPE_INT32ARRAY: return new Int32Array(buffer); case TYPE_UINT32ARRAY: return new Uint32Array(buffer); case TYPE_FLOAT32ARRAY: return new Float32Array(buffer); case TYPE_FLOAT64ARRAY: return new Float64Array(buffer); default: throw new Error('Unkown type: ' + type); } } var localforageSerializer = { serialize: serialize, deserialize: deserialize, stringToBuffer: stringToBuffer, bufferToString: bufferToString }; /* * Includes code from: * * base64-arraybuffer * https://github.com/niklasvh/base64-arraybuffer * * Copyright (c) 2012 Niklas von Hertzen * Licensed under the MIT license. */ function createDbTable(t, dbInfo, callback, errorCallback) { t.executeSql('CREATE TABLE IF NOT EXISTS ' + dbInfo.storeName + ' ' + '(id INTEGER PRIMARY KEY, key unique, value)', [], callback, errorCallback); } // Open the WebSQL database (automatically creates one if one didn't // previously exist), using any options set in the config. function _initStorage$1(options) { var self = this; var dbInfo = { db: null }; if (options) { for (var i in options) { dbInfo[i] = typeof options[i] !== 'string' ? options[i].toString() : options[i]; } } var dbInfoPromise = new Promise$1(function (resolve, reject) { // Open the database; the openDatabase API will automatically // create it for us if it doesn't exist. try { dbInfo.db = openDatabase(dbInfo.name, String(dbInfo.version), dbInfo.description, dbInfo.size); } catch (e) { return reject(e); } // Create our key/value table if it doesn't exist. dbInfo.db.transaction(function (t) { createDbTable(t, dbInfo, function () { self._dbInfo = dbInfo; resolve(); }, function (t, error) { reject(error); }); }, reject); }); dbInfo.serializer = localforageSerializer; return dbInfoPromise; } function tryExecuteSql(t, dbInfo, sqlStatement, args, callback, errorCallback) { t.executeSql(sqlStatement, args, callback, function (t, error) { if (error.code === error.SYNTAX_ERR) { t.executeSql('SELECT name FROM sqlite_master ' + "WHERE type='table' AND name = ?", [dbInfo.storeName], function (t, results) { if (!results.rows.length) { // if the table is missing (was deleted) // re-create it table and retry createDbTable(t, dbInfo, function () { t.executeSql(sqlStatement, args, callback, errorCallback); }, errorCallback); } else { errorCallback(t, error); } }, errorCallback); } else { errorCallback(t, error); } }, errorCallback); } function getItem$1(key, callback) { var self = this; key = normalizeKey(key); var promise = new Promise$1(function (resolve, reject) { self.ready().then(function () { var dbInfo = self._dbInfo; dbInfo.db.transaction(function (t) { tryExecuteSql(t, dbInfo, 'SELECT * FROM ' + dbInfo.storeName + ' WHERE key = ? LIMIT 1', [key], function (t, results) { var result = results.rows.length ? results.rows.item(0).value : null; // Check to see if this is serialized content we need to // unpack. if (result) { result = dbInfo.serializer.deserialize(result); } resolve(result); }, function (t, error) { reject(error); }); }); })["catch"](reject); }); executeCallback(promise, callback); return promise; } function iterate$1(iterator, callback) { var self = this; var promise = new Promise$1(function (resolve, reject) { self.ready().then(function () { var dbInfo = self._dbInfo; dbInfo.db.transaction(function (t) { tryExecuteSql(t, dbInfo, 'SELECT * FROM ' + dbInfo.storeName, [], function (t, results) { var rows = results.rows; var length = rows.length; for (var i = 0; i < length; i++) { var item = rows.item(i); var result = item.value; // Check to see if this is serialized content // we need to unpack. if (result) { result = dbInfo.serializer.deserialize(result); } result = iterator(result, item.key, i + 1); // void(0) prevents problems with redefinition // of `undefined`. if (result !== void 0) { resolve(result); return; } } resolve(); }, function (t, error) { reject(error); }); }); })["catch"](reject); }); executeCallback(promise, callback); return promise; } function _setItem(key, value, callback, retriesLeft) { var self = this; key = normalizeKey(key); var promise = new Promise$1(function (resolve, reject) { self.ready().then(function () { // The localStorage API doesn't return undefined values in an // "expected" way, so undefined is always cast to null in all // drivers. See: https://github.com/mozilla/localForage/pull/42 if (value === undefined) { value = null; } // Save the original value to pass to the callback. var originalValue = value; var dbInfo = self._dbInfo; dbInfo.serializer.serialize(value, function (value, error) { if (error) { reject(error); } else { dbInfo.db.transaction(function (t) { tryExecuteSql(t, dbInfo, 'INSERT OR REPLACE INTO ' + dbInfo.storeName + ' ' + '(key, value) VALUES (?, ?)', [key, value], function () { resolve(originalValue); }, function (t, error) { reject(error); }); }, function (sqlError) { // The transaction failed; check // to see if it's a quota error. if (sqlError.code === sqlError.QUOTA_ERR) { // We reject the callback outright for now, but // it's worth trying to re-run the transaction. // Even if the user accepts the prompt to use // more storage on Safari, this error will // be called. // // Try to re-run the transaction. if (retriesLeft > 0) { resolve(_setItem.apply(self, [key, originalValue, callback, retriesLeft - 1])); return; } reject(sqlError); } }); } }); })["catch"](reject); }); executeCallback(promise, callback); return promise; } function setItem$1(key, value, callback) { return _setItem.apply(this, [key, value, callback, 1]); } function removeItem$1(key, callback) { var self = this; key = normalizeKey(key); var promise = new Promise$1(function (resolve, reject) { self.ready().then(function () { var dbInfo = self._dbInfo; dbInfo.db.transaction(function (t) { tryExecuteSql(t, dbInfo, 'DELETE FROM ' + dbInfo.storeName + ' WHERE key = ?', [key], function () { resolve(); }, function (t, error) { reject(error); }); }); })["catch"](reject); }); executeCallback(promise, callback); return promise; } // Deletes every item in the table. // TODO: Find out if this resets the AUTO_INCREMENT number. function clear$1(callback) { var self = this; var promise = new Promise$1(function (resolve, reject) { self.ready().then(function () { var dbInfo = self._dbInfo; dbInfo.db.transaction(function (t) { tryExecuteSql(t, dbInfo, 'DELETE FROM ' + dbInfo.storeName, [], function () { resolve(); }, function (t, error) { reject(error); }); }); })["catch"](reject); }); executeCallback(promise, callback); return promise; } // Does a simple `COUNT(key)` to get the number of items stored in // localForage. function length$1(callback) { var self = this; var promise = new Promise$1(function (resolve, reject) { self.ready().then(function () { var dbInfo = self._dbInfo; dbInfo.db.transaction(function (t) { // Ahhh, SQL makes this one soooooo easy. tryExecuteSql(t, dbInfo, 'SELECT COUNT(key) as c FROM ' + dbInfo.storeName, [], function (t, results) { var result = results.rows.item(0).c; resolve(result); }, function (t, error) { reject(error); }); }); })["catch"](reject); }); executeCallback(promise, callback); return promise; } // Return the key located at key index X; essentially gets the key from a // `WHERE id = ?`. This is the most efficient way I can think to implement // this rarely-used (in my experience) part of the API, but it can seem // inconsistent, because we do `INSERT OR REPLACE INTO` on `setItem()`, so // the ID of each key will change every time it's updated. Perhaps a stored // procedure for the `setItem()` SQL would solve this problem? // TODO: Don't change ID on `setItem()`. function key$1(n, callback) { var self = this; var promise = new Promise$1(function (resolve, reject) { self.ready().then(function () { var dbInfo = self._dbInfo; dbInfo.db.transaction(function (t) { tryExecuteSql(t, dbInfo, 'SELECT key FROM ' + dbInfo.storeName + ' WHERE id = ? LIMIT 1', [n + 1], function (t, results) { var result = results.rows.length ? results.rows.item(0).key : null; resolve(result); }, function (t, error) { reject(error); }); }); })["catch"](reject); }); executeCallback(promise, callback); return promise; } function keys$1(callback) { var self = this; var promise = new Promise$1(function (resolve, reject) { self.ready().then(function () { var dbInfo = self._dbInfo; dbInfo.db.transaction(function (t) { tryExecuteSql(t, dbInfo, 'SELECT key FROM ' + dbInfo.storeName, [], function (t, results) { var keys = []; for (var i = 0; i < results.rows.length; i++) { keys.push(results.rows.item(i).key); } resolve(keys); }, function (t, error) { reject(error); }); }); })["catch"](reject); }); executeCallback(promise, callback); return promise; } // https://www.w3.org/TR/webdatabase/#databases // > There is no way to enumerate or delete the databases available for an origin from this API. function getAllStoreNames(db) { return new Promise$1(function (resolve, reject) { db.transaction(function (t) { t.executeSql('SELECT name FROM sqlite_master ' + "WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'", [], function (t, results) { var storeNames = []; for (var i = 0; i < results.rows.length; i++) { storeNames.push(results.rows.item(i).name); } resolve({ db: db, storeNames: storeNames }); }, function (t, error) { reject(error); }); }, function (sqlError) { reject(sqlError); }); }); } function dropInstance$1(options, callback) { callback = getCallback.apply(this, arguments); var currentConfig = this.config(); options = typeof options !== 'function' && options || {}; if (!options.name) { options.name = options.name || currentConfig.name; options.storeName = options.storeName || currentConfig.storeName; } var self = this; var promise; if (!options.name) { promise = Promise$1.reject('Invalid arguments'); } else { promise = new Promise$1(function (resolve) { var db; if (options.name === currentConfig.name) { // use the db reference of the current instance db = self._dbInfo.db; } else { db = openDatabase(options.name, '', '', 0); } if (!options.storeName) { // drop all database tables resolve(getAllStoreNames(db)); } else { resolve({ db: db, storeNames: [options.storeName] }); } }).then(function (operationInfo) { return new Promise$1(function (resolve, reject) { operationInfo.db.transaction(function (t) { function dropTable(storeName) { return new Promise$1(function (resolve, reject) { t.executeSql('DROP TABLE IF EXISTS ' + storeName, [], function () { resolve(); }, function (t, error) { reject(error); }); }); } var operations = []; for (var i = 0, len = operationInfo.storeNames.length; i < len; i++) { operations.push(dropTable(operationInfo.storeNames[i])); } Promise$1.all(operations).then(function () { resolve(); })["catch"](function (e) { reject(e); }); }, function (sqlError) { reject(sqlError); }); }); }); } executeCallback(promise, callback); return promise; } var webSQLStorage = { _driver: 'webSQLStorage', _initStorage: _initStorage$1, _support: isWebSQLValid(), iterate: iterate$1, getItem: getItem$1, setItem: setItem$1, removeItem: removeItem$1, clear: clear$1, length: length$1, key: key$1, keys: keys$1, dropInstance: dropInstance$1 }; function isLocalStorageValid() { try { return typeof localStorage !== 'undefined' && 'setItem' in localStorage && // in IE8 typeof localStorage.setItem === 'object' !!localStorage.setItem; } catch (e) { return false; } } function _getKeyPrefix(options, defaultConfig) { var keyPrefix = options.name + '/'; if (options.storeName !== defaultConfig.storeName) { keyPrefix += options.storeName + '/'; } return keyPrefix; } // Check if localStorage throws when saving an item function checkIfLocalStorageThrows() { var localStorageTestKey = '_localforage_support_test'; try { localStorage.setItem(localStorageTestKey, true); localStorage.removeItem(localStorageTestKey); return false; } catch (e) { return true; } } // Check if localStorage is usable and allows to save an item // This method checks if localStorage is usable in Safari Private Browsing // mode, or in any other case where the available quota for localStorage // is 0 and there wasn't any saved items yet. function _isLocalStorageUsable() { return !checkIfLocalStorageThrows() || localStorage.length > 0; } // Config the localStorage backend, using options set in the config. function _initStorage$2(options) { var self = this; var dbInfo = {}; if (options) { for (var i in options) { dbInfo[i] = options[i]; } } dbInfo.keyPrefix = _getKeyPrefix(options, self._defaultConfig); if (!_isLocalStorageUsable()) { return Promise$1.reject(); } self._dbInfo = dbInfo; dbInfo.serializer = localforageSerializer; return Promise$1.resolve(); } // Remove all keys from the datastore, effectively destroying all data in // the app's key/value store! function clear$2(callback) { var self = this; var promise = self.ready().then(function () { var keyPrefix = self._dbInfo.keyPrefix; for (var i = localStorage.length - 1; i >= 0; i--) { var key = localStorage.key(i); if (key.indexOf(keyPrefix) === 0) { localStorage.removeItem(key); } } }); executeCallback(promise, callback); return promise; } // Retrieve an item from the store. Unlike the original async_storage // library in Gaia, we don't modify return values at all. If a key's value // is `undefined`, we pass that value to the callback function. function getItem$2(key, callback) { var self = this; key = normalizeKey(key); var promise = self.ready().then(function () { var dbInfo = self._dbInfo; var result = localStorage.getItem(dbInfo.keyPrefix + key); // If a result was found, parse it from the serialized // string into a JS object. If result isn't truthy, the key // is likely undefined and we'll pass it straight to the // callback. if (result) { result = dbInfo.serializer.deserialize(result); } return result; }); executeCallback(promise, callback); return promise; } // Iterate over all items in the store. function iterate$2(iterator, callback) { var self = this; var promise = self.ready().then(function () { var dbInfo = self._dbInfo; var keyPrefix = dbInfo.keyPrefix; var keyPrefixLength = keyPrefix.length; var length = localStorage.length; // We use a dedicated iterator instead of the `i` variable below // so other keys we fetch in localStorage aren't counted in // the `iterationNumber` argument passed to the `iterate()` // callback. // // See: github.com/mozilla/localForage/pull/435#discussion_r38061530 var iterationNumber = 1; for (var i = 0; i < length; i++) { var key = localStorage.key(i); if (key.indexOf(keyPrefix) !== 0) { continue; } var value = localStorage.getItem(key); // If a result was found, parse it from the serialized // string into a JS object. If result isn't truthy, the // key is likely undefined and we'll pass it straight // to the iterator. if (value) { value = dbInfo.serializer.deserialize(value); } value = iterator(value, key.substring(keyPrefixLength), iterationNumber++); if (value !== void 0) { return value; } } }); executeCallback(promise, callback); return promise; } // Same as localStorage's key() method, except takes a callback. function key$2(n, callback) { var self = this; var promise = self.ready().then(function () { var dbInfo = self._dbInfo; var result; try { result = localStorage.key(n); } catch (error) { result = null; } // Remove the prefix from the key, if a key is found. if (result) { result = result.substring(dbInfo.keyPrefix.length); } return result; }); executeCallback(promise, callback); return promise; } function keys$2(callback) { var self = this; var promise = self.ready().then(function () { var dbInfo = self._dbInfo; var length = localStorage.length; var keys = []; for (var i = 0; i < length; i++) { var itemKey = localStorage.key(i); if (itemKey.indexOf(dbInfo.keyPrefix) === 0) { keys.push(itemKey.substring(dbInfo.keyPrefix.length)); } } return keys; }); executeCallback(promise, callback); return promise; } // Supply the number of keys in the datastore to the callback function. function length$2(callback) { var self = this; var promise = self.keys().then(function (keys) { return keys.length; }); executeCallback(promise, callback); return promise; } // Remove an item from the store, nice and simple. function removeItem$2(key, callback) { var self = this; key = normalizeKey(key); var promise = self.ready().then(function () { var dbInfo = self._dbInfo; localStorage.removeItem(dbInfo.keyPrefix + key); }); executeCallback(promise, callback); return promise; } // Set a key's value and run an optional callback once the value is set. // Unlike Gaia's implementation, the callback function is passed the value, // in case you want to operate on that value only after you're sure it // saved, or something like that. function setItem$2(key, value, callback) { var self = this; key = normalizeKey(key); var promise = self.ready().then(function () { // Convert undefined values to null. // https://github.com/mozilla/localForage/pull/42 if (value === undefined) { value = null; } // Save the original value to pass to the callback. var originalValue = value; return new Promise$1(function (resolve, reject) { var dbInfo = self._dbInfo; dbInfo.serializer.serialize(value, function (value, error) { if (error) { reject(error); } else { try { localStorage.setItem(dbInfo.keyPrefix + key, value); resolve(originalValue); } catch (e) { // localStorage capacity exceeded. // TODO: Make this a specific error/event. if (e.name === 'QuotaExceededError' || e.name === 'NS_ERROR_DOM_QUOTA_REACHED') { reject(e); } reject(e); } } }); }); }); executeCallback(promise, callback); return promise; } function dropInstance$2(options, callback) { callback = getCallback.apply(this, arguments); options = typeof options !== 'function' && options || {}; if (!options.name) { var currentConfig = this.config(); options.name = options.name || currentConfig.name; options.storeName = options.storeName || currentConfig.storeName; } var self = this; var promise; if (!options.name) { promise = Promise$1.reject('Invalid arguments'); } else { promise = new Promise$1(function (resolve) { if (!options.storeName) { resolve(options.name + '/'); } else { resolve(_getKeyPrefix(options, self._defaultConfig)); } }).then(function (keyPrefix) { for (var i = localStorage.length - 1; i >= 0; i--) { var key = localStorage.key(i); if (key.indexOf(keyPrefix) === 0) { localStorage.removeItem(key); } } }); } executeCallback(promise, callback); return promise; } var localStorageWrapper = { _driver: 'localStorageWrapper', _initStorage: _initStorage$2, _support: isLocalStorageValid(), iterate: iterate$2, getItem: getItem$2, setItem: setItem$2, removeItem: removeItem$2, clear: clear$2, length: length$2, key: key$2, keys: keys$2, dropInstance: dropInstance$2 }; var sameValue = function sameValue(x, y) { return x === y || typeof x === 'number' && typeof y === 'number' && isNaN(x) && isNaN(y); }; var includes = function includes(array, searchElement) { var len = array.length; var i = 0; while (i < len) { if (sameValue(array[i], searchElement)) { return true; } i++; } return false; }; var isArray = Array.isArray || function (arg) { return Object.prototype.toString.call(arg) === '[object Array]'; }; // Drivers are stored here when `defineDriver()` is called. // They are shared across all instances of localForage. var DefinedDrivers = {}; var DriverSupport = {}; var DefaultDrivers = { INDEXEDDB: asyncStorage, WEBSQL: webSQLStorage, LOCALSTORAGE: localStorageWrapper }; var DefaultDriverOrder = [DefaultDrivers.INDEXEDDB._driver, DefaultDrivers.WEBSQL._driver, DefaultDrivers.LOCALSTORAGE._driver]; var OptionalDriverMethods = ['dropInstance']; var LibraryMethods = ['clear', 'getItem', 'iterate', 'key', 'keys', 'length', 'removeItem', 'setItem'].concat(OptionalDriverMethods); var DefaultConfig = { description: '', driver: DefaultDriverOrder.slice(), name: 'localforage', // Default DB size is _JUST UNDER_ 5MB, as it's the highest size // we can use without a prompt. size: 4980736, storeName: 'keyvaluepairs', version: 1.0 }; function callWhenReady(localForageInstance, libraryMethod) { localForageInstance[libraryMethod] = function () { var _args = arguments; return localForageInstance.ready().then(function () { return localForageInstance[libraryMethod].apply(localForageInstance, _args); }); }; } function extend() { for (var i = 1; i < arguments.length; i++) { var arg = arguments[i]; if (arg) { for (var _key in arg) { if (arg.hasOwnProperty(_key)) { if (isArray(arg[_key])) { arguments[0][_key] = arg[_key].slice(); } else { arguments[0][_key] = arg[_key]; } } } } } return arguments[0]; } var LocalForage = function () { function LocalForage(options) { _classCallCheck(this, LocalForage); for (var driverTypeKey in DefaultDrivers) { if (DefaultDrivers.hasOwnProperty(driverTypeKey)) { var driver = DefaultDrivers[driverTypeKey]; var driverName = driver._driver; this[driverTypeKey] = driverName; if (!DefinedDrivers[driverName]) { // we don't need to wait for the promise, // since the default drivers can be defined // in a blocking manner this.defineDriver(driver); } } } this._defaultConfig = extend({}, DefaultConfig); this._config = extend({}, this._defaultConfig, options); this._driverSet = null; this._initDriver = null; this._ready = false; this._dbInfo = null; this._wrapLibraryMethodsWithReady(); this.setDriver(this._config.driver)["catch"](function () {}); } // Set any config values for localForage; can be called anytime before // the first API call (e.g. `getItem`, `setItem`). // We loop through options so we don't overwrite existing config // values. LocalForage.prototype.config = function config(options) { // If the options argument is an object, we use it to set values. // Otherwise, we return either a specified config value or all // config values. if ((typeof options === 'undefined' ? 'undefined' : _typeof(options)) === 'object') { // If localforage is ready and fully initialized, we can't set // any new configuration values. Instead, we return an error. if (this._ready) { return new Error("Can't call config() after localforage " + 'has been used.'); } for (var i in options) { if (i === 'storeName') { options[i] = options[i].replace(/\W/g, '_'); } if (i === 'version' && typeof options[i] !== 'number') { return new Error('Database version must be a number.'); } this._config[i] = options[i]; } // after all config options are set and // the driver option is used, try setting it if ('driver' in options && options.driver) { return this.setDriver(this._config.driver); } return true; } else if (typeof options === 'string') { return this._config[options]; } else { return this._config; } }; // Used to define a custom driver, shared across all instances of // localForage. LocalForage.prototype.defineDriver = function defineDriver(driverObject, callback, errorCallback) { var promise = new Promise$1(function (resolve, reject) { try { var driverName = driverObject._driver; var complianceError = new Error('Custom driver not compliant; see ' + 'https://mozilla.github.io/localForage/#definedriver'); // A driver name should be defined and not overlap with the // library-defined, default drivers. if (!driverObject._driver) { reject(complianceError); return; } var driverMethods = LibraryMethods.concat('_initStorage'); for (var i = 0, len = driverMethods.length; i < len; i++) { var driverMethodName = driverMethods[i]; // when the property is there, // it should be a method even when optional var isRequired = !includes(OptionalDriverMethods, driverMethodName); if ((isRequired || driverObject[driverMethodName]) && typeof driverObject[driverMethodName] !== 'function') { reject(complianceError); return; } } var configureMissingMethods = function configureMissingMethods() { var methodNotImplementedFactory = function methodNotImplementedFactory(methodName) { return function () { var error = new Error('Method ' + methodName + ' is not implemented by the current driver'); var promise = Promise$1.reject(error); executeCallback(promise, arguments[arguments.length - 1]); return promise; }; }; for (var _i = 0, _len = OptionalDriverMethods.length; _i < _len; _i++) { var optionalDriverMethod = OptionalDriverMethods[_i]; if (!driverObject[optionalDriverMethod]) { driverObject[optionalDriverMethod] = methodNotImplementedFactory(optionalDriverMethod); } } }; configureMissingMethods(); var setDriverSupport = function setDriverSupport(support) { if (DefinedDrivers[driverName]) { console.info('Redefining LocalForage driver: ' + driverName); } DefinedDrivers[driverName] = driverObject; DriverSupport[driverName] = support; // don't use a then, so that we can define // drivers that have simple _support methods // in a blocking manner resolve(); }; if ('_support' in driverObject) { if (driverObject._support && typeof driverObject._support === 'function') { driverObject._support().then(setDriverSupport, reject); } else { setDriverSupport(!!driverObject._support); } } else { setDriverSupport(true); } } catch (e) { reject(e); } }); executeTwoCallbacks(promise, callback, errorCallback); return promise; }; LocalForage.prototype.driver = function driver() { return this._driver || null; }; LocalForage.prototype.getDriver = function getDriver(driverName, callback, errorCallback) { var getDriverPromise = DefinedDrivers[driverName] ? Promise$1.resolve(DefinedDrivers[driverName]) : Promise$1.reject(new Error('Driver not found.')); executeTwoCallbacks(getDriverPromise, callback, errorCallback); return getDriverPromise; }; LocalForage.prototype.getSerializer = function getSerializer(callback) { var serializerPromise = Promise$1.resolve(localforageSerializer); executeTwoCallbacks(serializerPromise, callback); return serializerPromise; }; LocalForage.prototype.ready = function ready(callback) { var self = this; var promise = self._driverSet.then(function () { if (self._ready === null) { self._ready = self._initDriver(); } return self._ready; }); executeTwoCallbacks(promise, callback, callback); return promise; }; LocalForage.prototype.setDriver = function setDriver(drivers, callback, errorCallback) { var self = this; if (!isArray(drivers)) { drivers = [drivers]; } var supportedDrivers = this._getSupportedDrivers(drivers); function setDriverToConfig() { self._config.driver = self.driver(); } function extendSelfWithDriver(driver) { self._extend(driver); setDriverToConfig(); self._ready = self._initStorage(self._config); return self._ready; } function initDriver(supportedDrivers) { return function () { var currentDriverIndex = 0; function driverPromiseLoop() { while (currentDriverIndex < supportedDrivers.length) { var driverName = supportedDrivers[currentDriverIndex]; currentDriverIndex++; self._dbInfo = null; self._ready = null; return self.getDriver(driverName).then(extendSelfWithDriver)["catch"](driverPromiseLoop); } setDriverToConfig(); var error = new Error('No available storage method found.'); self._driverSet = Promise$1.reject(error); return self._driverSet; } return driverPromiseLoop(); }; } // There might be a driver initialization in progress // so wait for it to finish in order to avoid a possible // race condition to set _dbInfo var oldDriverSetDone = this._driverSet !== null ? this._driverSet["catch"](function () { return Promise$1.resolve(); }) : Promise$1.resolve(); this._driverSet = oldDriverSetDone.then(function () { var driverName = supportedDrivers[0]; self._dbInfo = null; self._ready = null; return self.getDriver(driverName).then(function (driver) { self._driver = driver._driver; setDriverToConfig(); self._wrapLibraryMethodsWithReady(); self._initDriver = initDriver(supportedDrivers); }); })["catch"](function () { setDriverToConfig(); var error = new Error('No available storage method found.'); self._driverSet = Promise$1.reject(error); return self._driverSet; }); executeTwoCallbacks(this._driverSet, callback, errorCallback); return this._driverSet; }; LocalForage.prototype.supports = function supports(driverName) { return !!DriverSupport[driverName]; }; LocalForage.prototype._extend = function _extend(libraryMethodsAndProperties) { extend(this, libraryMethodsAndProperties); }; LocalForage.prototype._getSupportedDrivers = function _getSupportedDrivers(drivers) { var supportedDrivers = []; for (var i = 0, len = drivers.length; i < len; i++) { var driverName = drivers[i]; if (this.supports(driverName)) { supportedDrivers.push(driverName); } } return supportedDrivers; }; LocalForage.prototype._wrapLibraryMethodsWithReady = function _wrapLibraryMethodsWithReady() { // Add a stub for each driver API method that delays the call to the // corresponding driver method until localForage is ready. These stubs // will be replaced by the driver methods as soon as the driver is // loaded, so there is no performance impact. for (var i = 0, len = LibraryMethods.length; i < len; i++) { callWhenReady(this, LibraryMethods[i]); } }; LocalForage.prototype.createInstance = function createInstance(options) { return new LocalForage(options); }; return LocalForage; }(); // The actual localForage object that we expose as a module or via a // global. It's extended by pulling in one of our other libraries. var localforage_js = new LocalForage(); module.exports = localforage_js; },{"3":3}]},{},[4])(4) }); /***/ }), /***/ 18552: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var getNative = __webpack_require__(10852), root = __webpack_require__(55639); /* Built-in method references that are verified to be native. */ var DataView = getNative(root, 'DataView'); module.exports = DataView; /***/ }), /***/ 1989: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var hashClear = __webpack_require__(51789), hashDelete = __webpack_require__(80401), hashGet = __webpack_require__(57667), hashHas = __webpack_require__(21327), hashSet = __webpack_require__(81866); /** * Creates a hash object. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function Hash(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } // Add methods to `Hash`. Hash.prototype.clear = hashClear; Hash.prototype['delete'] = hashDelete; Hash.prototype.get = hashGet; Hash.prototype.has = hashHas; Hash.prototype.set = hashSet; module.exports = Hash; /***/ }), /***/ 38407: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var listCacheClear = __webpack_require__(27040), listCacheDelete = __webpack_require__(14125), listCacheGet = __webpack_require__(82117), listCacheHas = __webpack_require__(67518), listCacheSet = __webpack_require__(54705); /** * Creates an list cache object. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function ListCache(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } // Add methods to `ListCache`. ListCache.prototype.clear = listCacheClear; ListCache.prototype['delete'] = listCacheDelete; ListCache.prototype.get = listCacheGet; ListCache.prototype.has = listCacheHas; ListCache.prototype.set = listCacheSet; module.exports = ListCache; /***/ }), /***/ 57071: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var getNative = __webpack_require__(10852), root = __webpack_require__(55639); /* Built-in method references that are verified to be native. */ var Map = getNative(root, 'Map'); module.exports = Map; /***/ }), /***/ 83369: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var mapCacheClear = __webpack_require__(24785), mapCacheDelete = __webpack_require__(11285), mapCacheGet = __webpack_require__(96000), mapCacheHas = __webpack_require__(49916), mapCacheSet = __webpack_require__(95265); /** * Creates a map cache object to store key-value pairs. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function MapCache(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } // Add methods to `MapCache`. MapCache.prototype.clear = mapCacheClear; MapCache.prototype['delete'] = mapCacheDelete; MapCache.prototype.get = mapCacheGet; MapCache.prototype.has = mapCacheHas; MapCache.prototype.set = mapCacheSet; module.exports = MapCache; /***/ }), /***/ 53818: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var getNative = __webpack_require__(10852), root = __webpack_require__(55639); /* Built-in method references that are verified to be native. */ var Promise = getNative(root, 'Promise'); module.exports = Promise; /***/ }), /***/ 58525: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var getNative = __webpack_require__(10852), root = __webpack_require__(55639); /* Built-in method references that are verified to be native. */ var Set = getNative(root, 'Set'); module.exports = Set; /***/ }), /***/ 88668: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var MapCache = __webpack_require__(83369), setCacheAdd = __webpack_require__(90619), setCacheHas = __webpack_require__(72385); /** * * Creates an array cache object to store unique values. * * @private * @constructor * @param {Array} [values] The values to cache. */ function SetCache(values) { var index = -1, length = values == null ? 0 : values.length; this.__data__ = new MapCache; while (++index < length) { this.add(values[index]); } } // Add methods to `SetCache`. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; SetCache.prototype.has = setCacheHas; module.exports = SetCache; /***/ }), /***/ 46384: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var ListCache = __webpack_require__(38407), stackClear = __webpack_require__(37465), stackDelete = __webpack_require__(63779), stackGet = __webpack_require__(67599), stackHas = __webpack_require__(44758), stackSet = __webpack_require__(34309); /** * Creates a stack cache object to store key-value pairs. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function Stack(entries) { var data = this.__data__ = new ListCache(entries); this.size = data.size; } // Add methods to `Stack`. Stack.prototype.clear = stackClear; Stack.prototype['delete'] = stackDelete; Stack.prototype.get = stackGet; Stack.prototype.has = stackHas; Stack.prototype.set = stackSet; module.exports = Stack; /***/ }), /***/ 62705: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var root = __webpack_require__(55639); /** Built-in value references. */ var Symbol = root.Symbol; module.exports = Symbol; /***/ }), /***/ 11149: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var root = __webpack_require__(55639); /** Built-in value references. */ var Uint8Array = root.Uint8Array; module.exports = Uint8Array; /***/ }), /***/ 70577: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var getNative = __webpack_require__(10852), root = __webpack_require__(55639); /* Built-in method references that are verified to be native. */ var WeakMap = getNative(root, 'WeakMap'); module.exports = WeakMap; /***/ }), /***/ 96874: /***/ (function(module) { /** * A faster alternative to `Function#apply`, this function invokes `func` * with the `this` binding of `thisArg` and the arguments of `args`. * * @private * @param {Function} func The function to invoke. * @param {*} thisArg The `this` binding of `func`. * @param {Array} args The arguments to invoke `func` with. * @returns {*} Returns the result of `func`. */ function apply(func, thisArg, args) { switch (args.length) { case 0: return func.call(thisArg); case 1: return func.call(thisArg, args[0]); case 2: return func.call(thisArg, args[0], args[1]); case 3: return func.call(thisArg, args[0], args[1], args[2]); } return func.apply(thisArg, args); } module.exports = apply; /***/ }), /***/ 44174: /***/ (function(module) { /** * A specialized version of `baseAggregator` for arrays. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} setter The function to set `accumulator` values. * @param {Function} iteratee The iteratee to transform keys. * @param {Object} accumulator The initial aggregated object. * @returns {Function} Returns `accumulator`. */ function arrayAggregator(array, setter, iteratee, accumulator) { var index = -1, length = array == null ? 0 : array.length; while (++index < length) { var value = array[index]; setter(accumulator, value, iteratee(value), array); } return accumulator; } module.exports = arrayAggregator; /***/ }), /***/ 34963: /***/ (function(module) { /** * A specialized version of `_.filter` for arrays without support for * iteratee shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {Array} Returns the new filtered array. */ function arrayFilter(array, predicate) { var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = []; while (++index < length) { var value = array[index]; if (predicate(value, index, array)) { result[resIndex++] = value; } } return result; } module.exports = arrayFilter; /***/ }), /***/ 47443: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseIndexOf = __webpack_require__(42118); /** * A specialized version of `_.includes` for arrays without support for * specifying an index to search from. * * @private * @param {Array} [array] The array to inspect. * @param {*} target The value to search for. * @returns {boolean} Returns `true` if `target` is found, else `false`. */ function arrayIncludes(array, value) { var length = array == null ? 0 : array.length; return !!length && baseIndexOf(array, value, 0) > -1; } module.exports = arrayIncludes; /***/ }), /***/ 1196: /***/ (function(module) { /** * This function is like `arrayIncludes` except that it accepts a comparator. * * @private * @param {Array} [array] The array to inspect. * @param {*} target The value to search for. * @param {Function} comparator The comparator invoked per element. * @returns {boolean} Returns `true` if `target` is found, else `false`. */ function arrayIncludesWith(array, value, comparator) { var index = -1, length = array == null ? 0 : array.length; while (++index < length) { if (comparator(value, array[index])) { return true; } } return false; } module.exports = arrayIncludesWith; /***/ }), /***/ 14636: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseTimes = __webpack_require__(22545), isArguments = __webpack_require__(1025), isArray = __webpack_require__(1469), isBuffer = __webpack_require__(44144), isIndex = __webpack_require__(65776), isTypedArray = __webpack_require__(36719); /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Creates an array of the enumerable property names of the array-like `value`. * * @private * @param {*} value The value to query. * @param {boolean} inherited Specify returning inherited property names. * @returns {Array} Returns the array of property names. */ function arrayLikeKeys(value, inherited) { var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length; for (var key in value) { if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && ( // Safari 9 has enumerable `arguments.length` in strict mode. key == 'length' || // Node.js 0.10 has enumerable non-index properties on buffers. (isBuff && (key == 'offset' || key == 'parent')) || // PhantomJS 2 has enumerable non-index properties on typed arrays. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || // Skip index properties. isIndex(key, length) ))) { result.push(key); } } return result; } module.exports = arrayLikeKeys; /***/ }), /***/ 29932: /***/ (function(module) { /** * A specialized version of `_.map` for arrays without support for iteratee * shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the new mapped array. */ function arrayMap(array, iteratee) { var index = -1, length = array == null ? 0 : array.length, result = Array(length); while (++index < length) { result[index] = iteratee(array[index], index, array); } return result; } module.exports = arrayMap; /***/ }), /***/ 62488: /***/ (function(module) { /** * Appends the elements of `values` to `array`. * * @private * @param {Array} array The array to modify. * @param {Array} values The values to append. * @returns {Array} Returns `array`. */ function arrayPush(array, values) { var index = -1, length = values.length, offset = array.length; while (++index < length) { array[offset + index] = values[index]; } return array; } module.exports = arrayPush; /***/ }), /***/ 62663: /***/ (function(module) { /** * A specialized version of `_.reduce` for arrays without support for * iteratee shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} [accumulator] The initial value. * @param {boolean} [initAccum] Specify using the first element of `array` as * the initial value. * @returns {*} Returns the accumulated value. */ function arrayReduce(array, iteratee, accumulator, initAccum) { var index = -1, length = array == null ? 0 : array.length; if (initAccum && length) { accumulator = array[++index]; } while (++index < length) { accumulator = iteratee(accumulator, array[index], index, array); } return accumulator; } module.exports = arrayReduce; /***/ }), /***/ 82908: /***/ (function(module) { /** * A specialized version of `_.some` for arrays without support for iteratee * shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {boolean} Returns `true` if any element passes the predicate check, * else `false`. */ function arraySome(array, predicate) { var index = -1, length = array == null ? 0 : array.length; while (++index < length) { if (predicate(array[index], index, array)) { return true; } } return false; } module.exports = arraySome; /***/ }), /***/ 49029: /***/ (function(module) { /** Used to match words composed of alphanumeric characters. */ var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; /** * Splits an ASCII `string` into an array of its words. * * @private * @param {string} The string to inspect. * @returns {Array} Returns the words of `string`. */ function asciiWords(string) { return string.match(reAsciiWord) || []; } module.exports = asciiWords; /***/ }), /***/ 86556: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseAssignValue = __webpack_require__(89465), eq = __webpack_require__(77813); /** * This function is like `assignValue` except that it doesn't assign * `undefined` values. * * @private * @param {Object} object The object to modify. * @param {string} key The key of the property to assign. * @param {*} value The value to assign. */ function assignMergeValue(object, key, value) { if ((value !== undefined && !eq(object[key], value)) || (value === undefined && !(key in object))) { baseAssignValue(object, key, value); } } module.exports = assignMergeValue; /***/ }), /***/ 34865: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseAssignValue = __webpack_require__(89465), eq = __webpack_require__(77813); /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Assigns `value` to `key` of `object` if the existing value is not equivalent * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons. * * @private * @param {Object} object The object to modify. * @param {string} key The key of the property to assign. * @param {*} value The value to assign. */ function assignValue(object, key, value) { var objValue = object[key]; if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || (value === undefined && !(key in object))) { baseAssignValue(object, key, value); } } module.exports = assignValue; /***/ }), /***/ 18470: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var eq = __webpack_require__(77813); /** * Gets the index at which the `key` is found in `array` of key-value pairs. * * @private * @param {Array} array The array to inspect. * @param {*} key The key to search for. * @returns {number} Returns the index of the matched value, else `-1`. */ function assocIndexOf(array, key) { var length = array.length; while (length--) { if (eq(array[length][0], key)) { return length; } } return -1; } module.exports = assocIndexOf; /***/ }), /***/ 81119: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseEach = __webpack_require__(89881); /** * Aggregates elements of `collection` on `accumulator` with keys transformed * by `iteratee` and values set by `setter`. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} setter The function to set `accumulator` values. * @param {Function} iteratee The iteratee to transform keys. * @param {Object} accumulator The initial aggregated object. * @returns {Function} Returns `accumulator`. */ function baseAggregator(collection, setter, iteratee, accumulator) { baseEach(collection, function(value, key, collection) { setter(accumulator, value, iteratee(value), collection); }); return accumulator; } module.exports = baseAggregator; /***/ }), /***/ 89465: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var defineProperty = __webpack_require__(38777); /** * The base implementation of `assignValue` and `assignMergeValue` without * value checks. * * @private * @param {Object} object The object to modify. * @param {string} key The key of the property to assign. * @param {*} value The value to assign. */ function baseAssignValue(object, key, value) { if (key == '__proto__' && defineProperty) { defineProperty(object, key, { 'configurable': true, 'enumerable': true, 'value': value, 'writable': true }); } else { object[key] = value; } } module.exports = baseAssignValue; /***/ }), /***/ 3118: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var isObject = __webpack_require__(13218); /** Built-in value references. */ var objectCreate = Object.create; /** * The base implementation of `_.create` without support for assigning * properties to the created object. * * @private * @param {Object} proto The object to inherit from. * @returns {Object} Returns the new object. */ var baseCreate = (function() { function object() {} return function(proto) { if (!isObject(proto)) { return {}; } if (objectCreate) { return objectCreate(proto); } object.prototype = proto; var result = new object; object.prototype = undefined; return result; }; }()); module.exports = baseCreate; /***/ }), /***/ 38845: /***/ (function(module) { /** Error message constants. */ var FUNC_ERROR_TEXT = 'Expected a function'; /** * The base implementation of `_.delay` and `_.defer` which accepts `args` * to provide to `func`. * * @private * @param {Function} func The function to delay. * @param {number} wait The number of milliseconds to delay invocation. * @param {Array} args The arguments to provide to `func`. * @returns {number|Object} Returns the timer id or timeout object. */ function baseDelay(func, wait, args) { if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } return setTimeout(function() { func.apply(undefined, args); }, wait); } module.exports = baseDelay; /***/ }), /***/ 89881: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseForOwn = __webpack_require__(47816), createBaseEach = __webpack_require__(99291); /** * The base implementation of `_.forEach` without support for iteratee shorthands. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array|Object} Returns `collection`. */ var baseEach = createBaseEach(baseForOwn); module.exports = baseEach; /***/ }), /***/ 41848: /***/ (function(module) { /** * The base implementation of `_.findIndex` and `_.findLastIndex` without * support for iteratee shorthands. * * @private * @param {Array} array The array to inspect. * @param {Function} predicate The function invoked per iteration. * @param {number} fromIndex The index to search from. * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {number} Returns the index of the matched value, else `-1`. */ function baseFindIndex(array, predicate, fromIndex, fromRight) { var length = array.length, index = fromIndex + (fromRight ? 1 : -1); while ((fromRight ? index-- : ++index < length)) { if (predicate(array[index], index, array)) { return index; } } return -1; } module.exports = baseFindIndex; /***/ }), /***/ 21078: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var arrayPush = __webpack_require__(62488), isFlattenable = __webpack_require__(37285); /** * The base implementation of `_.flatten` with support for restricting flattening. * * @private * @param {Array} array The array to flatten. * @param {number} depth The maximum recursion depth. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. * @param {Array} [result=[]] The initial result value. * @returns {Array} Returns the new flattened array. */ function baseFlatten(array, depth, predicate, isStrict, result) { var index = -1, length = array.length; predicate || (predicate = isFlattenable); result || (result = []); while (++index < length) { var value = array[index]; if (depth > 0 && predicate(value)) { if (depth > 1) { // Recursively flatten arrays (susceptible to call stack limits). baseFlatten(value, depth - 1, predicate, isStrict, result); } else { arrayPush(result, value); } } else if (!isStrict) { result[result.length] = value; } } return result; } module.exports = baseFlatten; /***/ }), /***/ 28483: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var createBaseFor = __webpack_require__(25063); /** * The base implementation of `baseForOwn` which iterates over `object` * properties returned by `keysFunc` and invokes `iteratee` for each property. * Iteratee functions may exit iteration early by explicitly returning `false`. * * @private * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {Function} keysFunc The function to get the keys of `object`. * @returns {Object} Returns `object`. */ var baseFor = createBaseFor(); module.exports = baseFor; /***/ }), /***/ 47816: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseFor = __webpack_require__(28483), keys = __webpack_require__(3674); /** * The base implementation of `_.forOwn` without support for iteratee shorthands. * * @private * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Object} Returns `object`. */ function baseForOwn(object, iteratee) { return object && baseFor(object, iteratee, keys); } module.exports = baseForOwn; /***/ }), /***/ 97786: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var castPath = __webpack_require__(71811), toKey = __webpack_require__(40327); /** * The base implementation of `_.get` without support for default values. * * @private * @param {Object} object The object to query. * @param {Array|string} path The path of the property to get. * @returns {*} Returns the resolved value. */ function baseGet(object, path) { path = castPath(path, object); var index = 0, length = path.length; while (object != null && index < length) { object = object[toKey(path[index++])]; } return (index && index == length) ? object : undefined; } module.exports = baseGet; /***/ }), /***/ 68866: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var arrayPush = __webpack_require__(62488), isArray = __webpack_require__(1469); /** * The base implementation of `getAllKeys` and `getAllKeysIn` which uses * `keysFunc` and `symbolsFunc` to get the enumerable property names and * symbols of `object`. * * @private * @param {Object} object The object to query. * @param {Function} keysFunc The function to get the keys of `object`. * @param {Function} symbolsFunc The function to get the symbols of `object`. * @returns {Array} Returns the array of property names and symbols. */ function baseGetAllKeys(object, keysFunc, symbolsFunc) { var result = keysFunc(object); return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); } module.exports = baseGetAllKeys; /***/ }), /***/ 44239: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var Symbol = __webpack_require__(62705), getRawTag = __webpack_require__(89607), objectToString = __webpack_require__(2333); /** `Object#toString` result references. */ var nullTag = '[object Null]', undefinedTag = '[object Undefined]'; /** Built-in value references. */ var symToStringTag = Symbol ? Symbol.toStringTag : undefined; /** * The base implementation of `getTag` without fallbacks for buggy environments. * * @private * @param {*} value The value to query. * @returns {string} Returns the `toStringTag`. */ function baseGetTag(value) { if (value == null) { return value === undefined ? undefinedTag : nullTag; } return (symToStringTag && symToStringTag in Object(value)) ? getRawTag(value) : objectToString(value); } module.exports = baseGetTag; /***/ }), /***/ 13: /***/ (function(module) { /** * The base implementation of `_.hasIn` without support for deep paths. * * @private * @param {Object} [object] The object to query. * @param {Array|string} key The key to check. * @returns {boolean} Returns `true` if `key` exists, else `false`. */ function baseHasIn(object, key) { return object != null && key in Object(object); } module.exports = baseHasIn; /***/ }), /***/ 42118: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseFindIndex = __webpack_require__(41848), baseIsNaN = __webpack_require__(62722), strictIndexOf = __webpack_require__(42351); /** * The base implementation of `_.indexOf` without `fromIndex` bounds checks. * * @private * @param {Array} array The array to inspect. * @param {*} value The value to search for. * @param {number} fromIndex The index to search from. * @returns {number} Returns the index of the matched value, else `-1`. */ function baseIndexOf(array, value, fromIndex) { return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex); } module.exports = baseIndexOf; /***/ }), /***/ 9454: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseGetTag = __webpack_require__(44239), isObjectLike = __webpack_require__(37005); /** `Object#toString` result references. */ var argsTag = '[object Arguments]'; /** * The base implementation of `_.isArguments`. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an `arguments` object, */ function baseIsArguments(value) { return isObjectLike(value) && baseGetTag(value) == argsTag; } module.exports = baseIsArguments; /***/ }), /***/ 90939: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseIsEqualDeep = __webpack_require__(2492), isObjectLike = __webpack_require__(37005); /** * The base implementation of `_.isEqual` which supports partial comparisons * and tracks traversed objects. * * @private * @param {*} value The value to compare. * @param {*} other The other value to compare. * @param {boolean} bitmask The bitmask flags. * 1 - Unordered comparison * 2 - Partial comparison * @param {Function} [customizer] The function to customize comparisons. * @param {Object} [stack] Tracks traversed `value` and `other` objects. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. */ function baseIsEqual(value, other, bitmask, customizer, stack) { if (value === other) { return true; } if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) { return value !== value && other !== other; } return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); } module.exports = baseIsEqual; /***/ }), /***/ 2492: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var Stack = __webpack_require__(46384), equalArrays = __webpack_require__(67114), equalByTag = __webpack_require__(18351), equalObjects = __webpack_require__(16096), getTag = __webpack_require__(64160), isArray = __webpack_require__(1469), isBuffer = __webpack_require__(44144), isTypedArray = __webpack_require__(36719); /** Used to compose bitmasks for value comparisons. */ var COMPARE_PARTIAL_FLAG = 1; /** `Object#toString` result references. */ var argsTag = '[object Arguments]', arrayTag = '[object Array]', objectTag = '[object Object]'; /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * A specialized version of `baseIsEqual` for arrays and objects which performs * deep comparisons and tracks traversed objects enabling objects with circular * references to be compared. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. * @param {Function} customizer The function to customize comparisons. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Object} [stack] Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other); objTag = objTag == argsTag ? objectTag : objTag; othTag = othTag == argsTag ? objectTag : othTag; var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag; if (isSameTag && isBuffer(object)) { if (!isBuffer(other)) { return false; } objIsArr = true; objIsObj = false; } if (isSameTag && !objIsObj) { stack || (stack = new Stack); return (objIsArr || isTypedArray(object)) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); } if (!(bitmask & COMPARE_PARTIAL_FLAG)) { var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); if (objIsWrapped || othIsWrapped) { var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other; stack || (stack = new Stack); return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); } } if (!isSameTag) { return false; } stack || (stack = new Stack); return equalObjects(object, other, bitmask, customizer, equalFunc, stack); } module.exports = baseIsEqualDeep; /***/ }), /***/ 57365: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var Stack = __webpack_require__(46384), baseIsEqual = __webpack_require__(90939); /** Used to compose bitmasks for value comparisons. */ var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2; /** * The base implementation of `_.isMatch` without support for iteratee shorthands. * * @private * @param {Object} object The object to inspect. * @param {Object} source The object of property values to match. * @param {Array} matchData The property names, values, and compare flags to match. * @param {Function} [customizer] The function to customize comparisons. * @returns {boolean} Returns `true` if `object` is a match, else `false`. */ function baseIsMatch(object, source, matchData, customizer) { var index = matchData.length, length = index, noCustomizer = !customizer; if (object == null) { return !length; } object = Object(object); while (index--) { var data = matchData[index]; if ((noCustomizer && data[2]) ? data[1] !== object[data[0]] : !(data[0] in object) ) { return false; } } while (++index < length) { data = matchData[index]; var key = data[0], objValue = object[key], srcValue = data[1]; if (noCustomizer && data[2]) { if (objValue === undefined && !(key in object)) { return false; } } else { var stack = new Stack; if (customizer) { var result = customizer(objValue, srcValue, key, object, source, stack); } if (!(result === undefined ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) : result )) { return false; } } } return true; } module.exports = baseIsMatch; /***/ }), /***/ 62722: /***/ (function(module) { /** * The base implementation of `_.isNaN` without support for number objects. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. */ function baseIsNaN(value) { return value !== value; } module.exports = baseIsNaN; /***/ }), /***/ 28458: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var isFunction = __webpack_require__(23560), isMasked = __webpack_require__(15346), isObject = __webpack_require__(13218), toSource = __webpack_require__(80346); /** * Used to match `RegExp` * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; /** Used to detect host constructors (Safari). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; /** Used for built-in method references. */ var funcProto = Function.prototype, objectProto = Object.prototype; /** Used to resolve the decompiled source of functions. */ var funcToString = funcProto.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** Used to detect if a method is native. */ var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); /** * The base implementation of `_.isNative` without bad shim checks. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a native function, * else `false`. */ function baseIsNative(value) { if (!isObject(value) || isMasked(value)) { return false; } var pattern = isFunction(value) ? reIsNative : reIsHostCtor; return pattern.test(toSource(value)); } module.exports = baseIsNative; /***/ }), /***/ 38749: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseGetTag = __webpack_require__(44239), isLength = __webpack_require__(41780), isObjectLike = __webpack_require__(37005); /** `Object#toString` result references. */ var argsTag = '[object Arguments]', arrayTag = '[object Array]', boolTag = '[object Boolean]', dateTag = '[object Date]', errorTag = '[object Error]', funcTag = '[object Function]', mapTag = '[object Map]', numberTag = '[object Number]', objectTag = '[object Object]', regexpTag = '[object RegExp]', setTag = '[object Set]', stringTag = '[object String]', weakMapTag = '[object WeakMap]'; var arrayBufferTag = '[object ArrayBuffer]', dataViewTag = '[object DataView]', float32Tag = '[object Float32Array]', float64Tag = '[object Float64Array]', int8Tag = '[object Int8Array]', int16Tag = '[object Int16Array]', int32Tag = '[object Int32Array]', uint8Tag = '[object Uint8Array]', uint8ClampedTag = '[object Uint8ClampedArray]', uint16Tag = '[object Uint16Array]', uint32Tag = '[object Uint32Array]'; /** Used to identify `toStringTag` values of typed arrays. */ var typedArrayTags = {}; typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; /** * The base implementation of `_.isTypedArray` without Node.js optimizations. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. */ function baseIsTypedArray(value) { return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; } module.exports = baseIsTypedArray; /***/ }), /***/ 67206: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseMatches = __webpack_require__(91573), baseMatchesProperty = __webpack_require__(16432), identity = __webpack_require__(6557), isArray = __webpack_require__(1469), property = __webpack_require__(39601); /** * The base implementation of `_.iteratee`. * * @private * @param {*} [value=_.identity] The value to convert to an iteratee. * @returns {Function} Returns the iteratee. */ function baseIteratee(value) { // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. if (typeof value == 'function') { return value; } if (value == null) { return identity; } if (typeof value == 'object') { return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value); } return property(value); } module.exports = baseIteratee; /***/ }), /***/ 280: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var isPrototype = __webpack_require__(25726), nativeKeys = __webpack_require__(86916); /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function baseKeys(object) { if (!isPrototype(object)) { return nativeKeys(object); } var result = []; for (var key in Object(object)) { if (hasOwnProperty.call(object, key) && key != 'constructor') { result.push(key); } } return result; } module.exports = baseKeys; /***/ }), /***/ 10313: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var isObject = __webpack_require__(13218), isPrototype = __webpack_require__(25726), nativeKeysIn = __webpack_require__(33498); /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function baseKeysIn(object) { if (!isObject(object)) { return nativeKeysIn(object); } var isProto = isPrototype(object), result = []; for (var key in object) { if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { result.push(key); } } return result; } module.exports = baseKeysIn; /***/ }), /***/ 69199: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseEach = __webpack_require__(89881), isArrayLike = __webpack_require__(98612); /** * The base implementation of `_.map` without support for iteratee shorthands. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the new mapped array. */ function baseMap(collection, iteratee) { var index = -1, result = isArrayLike(collection) ? Array(collection.length) : []; baseEach(collection, function(value, key, collection) { result[++index] = iteratee(value, key, collection); }); return result; } module.exports = baseMap; /***/ }), /***/ 91573: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseIsMatch = __webpack_require__(57365), getMatchData = __webpack_require__(1499), matchesStrictComparable = __webpack_require__(42634); /** * The base implementation of `_.matches` which doesn't clone `source`. * * @private * @param {Object} source The object of property values to match. * @returns {Function} Returns the new spec function. */ function baseMatches(source) { var matchData = getMatchData(source); if (matchData.length == 1 && matchData[0][2]) { return matchesStrictComparable(matchData[0][0], matchData[0][1]); } return function(object) { return object === source || baseIsMatch(object, source, matchData); }; } module.exports = baseMatches; /***/ }), /***/ 16432: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseIsEqual = __webpack_require__(90939), get = __webpack_require__(27361), hasIn = __webpack_require__(79095), isKey = __webpack_require__(15403), isStrictComparable = __webpack_require__(89162), matchesStrictComparable = __webpack_require__(42634), toKey = __webpack_require__(40327); /** Used to compose bitmasks for value comparisons. */ var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2; /** * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. * * @private * @param {string} path The path of the property to get. * @param {*} srcValue The value to match. * @returns {Function} Returns the new spec function. */ function baseMatchesProperty(path, srcValue) { if (isKey(path) && isStrictComparable(srcValue)) { return matchesStrictComparable(toKey(path), srcValue); } return function(object) { var objValue = get(object, path); return (objValue === undefined && objValue === srcValue) ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); }; } module.exports = baseMatchesProperty; /***/ }), /***/ 42980: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var Stack = __webpack_require__(46384), assignMergeValue = __webpack_require__(86556), baseFor = __webpack_require__(28483), baseMergeDeep = __webpack_require__(59783), isObject = __webpack_require__(13218), keysIn = __webpack_require__(81704), safeGet = __webpack_require__(36390); /** * The base implementation of `_.merge` without support for multiple sources. * * @private * @param {Object} object The destination object. * @param {Object} source The source object. * @param {number} srcIndex The index of `source`. * @param {Function} [customizer] The function to customize merged values. * @param {Object} [stack] Tracks traversed source values and their merged * counterparts. */ function baseMerge(object, source, srcIndex, customizer, stack) { if (object === source) { return; } baseFor(source, function(srcValue, key) { stack || (stack = new Stack); if (isObject(srcValue)) { baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); } else { var newValue = customizer ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) : undefined; if (newValue === undefined) { newValue = srcValue; } assignMergeValue(object, key, newValue); } }, keysIn); } module.exports = baseMerge; /***/ }), /***/ 59783: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var assignMergeValue = __webpack_require__(86556), cloneBuffer = __webpack_require__(64626), cloneTypedArray = __webpack_require__(77133), copyArray = __webpack_require__(278), initCloneObject = __webpack_require__(38517), isArguments = __webpack_require__(1025), isArray = __webpack_require__(1469), isArrayLikeObject = __webpack_require__(29246), isBuffer = __webpack_require__(44144), isFunction = __webpack_require__(23560), isObject = __webpack_require__(13218), isPlainObject = __webpack_require__(68630), isTypedArray = __webpack_require__(36719), safeGet = __webpack_require__(36390), toPlainObject = __webpack_require__(59881); /** * A specialized version of `baseMerge` for arrays and objects which performs * deep merges and tracks traversed objects enabling objects with circular * references to be merged. * * @private * @param {Object} object The destination object. * @param {Object} source The source object. * @param {string} key The key of the value to merge. * @param {number} srcIndex The index of `source`. * @param {Function} mergeFunc The function to merge values. * @param {Function} [customizer] The function to customize assigned values. * @param {Object} [stack] Tracks traversed source values and their merged * counterparts. */ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue); if (stacked) { assignMergeValue(object, key, stacked); return; } var newValue = customizer ? customizer(objValue, srcValue, (key + ''), object, source, stack) : undefined; var isCommon = newValue === undefined; if (isCommon) { var isArr = isArray(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue); newValue = srcValue; if (isArr || isBuff || isTyped) { if (isArray(objValue)) { newValue = objValue; } else if (isArrayLikeObject(objValue)) { newValue = copyArray(objValue); } else if (isBuff) { isCommon = false; newValue = cloneBuffer(srcValue, true); } else if (isTyped) { isCommon = false; newValue = cloneTypedArray(srcValue, true); } else { newValue = []; } } else if (isPlainObject(srcValue) || isArguments(srcValue)) { newValue = objValue; if (isArguments(objValue)) { newValue = toPlainObject(objValue); } else if (!isObject(objValue) || isFunction(objValue)) { newValue = initCloneObject(srcValue); } } else { isCommon = false; } } if (isCommon) { // Recursively merge objects and arrays (susceptible to call stack limits). stack.set(srcValue, newValue); mergeFunc(newValue, srcValue, srcIndex, customizer, stack); stack['delete'](srcValue); } assignMergeValue(object, key, newValue); } module.exports = baseMergeDeep; /***/ }), /***/ 82689: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var arrayMap = __webpack_require__(29932), baseGet = __webpack_require__(97786), baseIteratee = __webpack_require__(67206), baseMap = __webpack_require__(69199), baseSortBy = __webpack_require__(71131), baseUnary = __webpack_require__(7518), compareMultiple = __webpack_require__(85022), identity = __webpack_require__(6557), isArray = __webpack_require__(1469); /** * The base implementation of `_.orderBy` without param guards. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. * @param {string[]} orders The sort orders of `iteratees`. * @returns {Array} Returns the new sorted array. */ function baseOrderBy(collection, iteratees, orders) { if (iteratees.length) { iteratees = arrayMap(iteratees, function(iteratee) { if (isArray(iteratee)) { return function(value) { return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee); } } return iteratee; }); } else { iteratees = [identity]; } var index = -1; iteratees = arrayMap(iteratees, baseUnary(baseIteratee)); var result = baseMap(collection, function(value, key, collection) { var criteria = arrayMap(iteratees, function(iteratee) { return iteratee(value); }); return { 'criteria': criteria, 'index': ++index, 'value': value }; }); return baseSortBy(result, function(object, other) { return compareMultiple(object, other, orders); }); } module.exports = baseOrderBy; /***/ }), /***/ 63012: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseGet = __webpack_require__(97786), baseSet = __webpack_require__(10611), castPath = __webpack_require__(71811); /** * The base implementation of `_.pickBy` without support for iteratee shorthands. * * @private * @param {Object} object The source object. * @param {string[]} paths The property paths to pick. * @param {Function} predicate The function invoked per property. * @returns {Object} Returns the new object. */ function basePickBy(object, paths, predicate) { var index = -1, length = paths.length, result = {}; while (++index < length) { var path = paths[index], value = baseGet(object, path); if (predicate(value, path)) { baseSet(result, castPath(path, object), value); } } return result; } module.exports = basePickBy; /***/ }), /***/ 40371: /***/ (function(module) { /** * The base implementation of `_.property` without support for deep paths. * * @private * @param {string} key The key of the property to get. * @returns {Function} Returns the new accessor function. */ function baseProperty(key) { return function(object) { return object == null ? undefined : object[key]; }; } module.exports = baseProperty; /***/ }), /***/ 79152: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseGet = __webpack_require__(97786); /** * A specialized version of `baseProperty` which supports deep paths. * * @private * @param {Array|string} path The path of the property to get. * @returns {Function} Returns the new accessor function. */ function basePropertyDeep(path) { return function(object) { return baseGet(object, path); }; } module.exports = basePropertyDeep; /***/ }), /***/ 18674: /***/ (function(module) { /** * The base implementation of `_.propertyOf` without support for deep paths. * * @private * @param {Object} object The object to query. * @returns {Function} Returns the new accessor function. */ function basePropertyOf(object) { return function(key) { return object == null ? undefined : object[key]; }; } module.exports = basePropertyOf; /***/ }), /***/ 40098: /***/ (function(module) { /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeCeil = Math.ceil, nativeMax = Math.max; /** * The base implementation of `_.range` and `_.rangeRight` which doesn't * coerce arguments. * * @private * @param {number} start The start of the range. * @param {number} end The end of the range. * @param {number} step The value to increment or decrement by. * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Array} Returns the range of numbers. */ function baseRange(start, end, step, fromRight) { var index = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result = Array(length); while (length--) { result[fromRight ? length : ++index] = start; start += step; } return result; } module.exports = baseRange; /***/ }), /***/ 5976: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var identity = __webpack_require__(6557), overRest = __webpack_require__(45357), setToString = __webpack_require__(30061); /** * The base implementation of `_.rest` which doesn't validate or coerce arguments. * * @private * @param {Function} func The function to apply a rest parameter to. * @param {number} [start=func.length-1] The start position of the rest parameter. * @returns {Function} Returns the new function. */ function baseRest(func, start) { return setToString(overRest(func, start, identity), func + ''); } module.exports = baseRest; /***/ }), /***/ 10611: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var assignValue = __webpack_require__(34865), castPath = __webpack_require__(71811), isIndex = __webpack_require__(65776), isObject = __webpack_require__(13218), toKey = __webpack_require__(40327); /** * The base implementation of `_.set`. * * @private * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to set. * @param {*} value The value to set. * @param {Function} [customizer] The function to customize path creation. * @returns {Object} Returns `object`. */ function baseSet(object, path, value, customizer) { if (!isObject(object)) { return object; } path = castPath(path, object); var index = -1, length = path.length, lastIndex = length - 1, nested = object; while (nested != null && ++index < length) { var key = toKey(path[index]), newValue = value; if (key === '__proto__' || key === 'constructor' || key === 'prototype') { return object; } if (index != lastIndex) { var objValue = nested[key]; newValue = customizer ? customizer(objValue, key, nested) : undefined; if (newValue === undefined) { newValue = isObject(objValue) ? objValue : (isIndex(path[index + 1]) ? [] : {}); } } assignValue(nested, key, newValue); nested = nested[key]; } return object; } module.exports = baseSet; /***/ }), /***/ 56560: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var constant = __webpack_require__(75703), defineProperty = __webpack_require__(38777), identity = __webpack_require__(6557); /** * The base implementation of `setToString` without support for hot loop shorting. * * @private * @param {Function} func The function to modify. * @param {Function} string The `toString` result. * @returns {Function} Returns `func`. */ var baseSetToString = !defineProperty ? identity : function(func, string) { return defineProperty(func, 'toString', { 'configurable': true, 'enumerable': false, 'value': constant(string), 'writable': true }); }; module.exports = baseSetToString; /***/ }), /***/ 14259: /***/ (function(module) { /** * The base implementation of `_.slice` without an iteratee call guard. * * @private * @param {Array} array The array to slice. * @param {number} [start=0] The start position. * @param {number} [end=array.length] The end position. * @returns {Array} Returns the slice of `array`. */ function baseSlice(array, start, end) { var index = -1, length = array.length; if (start < 0) { start = -start > length ? 0 : (length + start); } end = end > length ? length : end; if (end < 0) { end += length; } length = start > end ? 0 : ((end - start) >>> 0); start >>>= 0; var result = Array(length); while (++index < length) { result[index] = array[index + start]; } return result; } module.exports = baseSlice; /***/ }), /***/ 71131: /***/ (function(module) { /** * The base implementation of `_.sortBy` which uses `comparer` to define the * sort order of `array` and replaces criteria objects with their corresponding * values. * * @private * @param {Array} array The array to sort. * @param {Function} comparer The function to define sort order. * @returns {Array} Returns `array`. */ function baseSortBy(array, comparer) { var length = array.length; array.sort(comparer); while (length--) { array[length] = array[length].value; } return array; } module.exports = baseSortBy; /***/ }), /***/ 22545: /***/ (function(module) { /** * The base implementation of `_.times` without support for iteratee shorthands * or max array length checks. * * @private * @param {number} n The number of times to invoke `iteratee`. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the array of results. */ function baseTimes(n, iteratee) { var index = -1, result = Array(n); while (++index < n) { result[index] = iteratee(index); } return result; } module.exports = baseTimes; /***/ }), /***/ 80531: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var Symbol = __webpack_require__(62705), arrayMap = __webpack_require__(29932), isArray = __webpack_require__(1469), isSymbol = __webpack_require__(33448); /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0; /** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol ? Symbol.prototype : undefined, symbolToString = symbolProto ? symbolProto.toString : undefined; /** * The base implementation of `_.toString` which doesn't convert nullish * values to empty strings. * * @private * @param {*} value The value to process. * @returns {string} Returns the string. */ function baseToString(value) { // Exit early for strings to avoid a performance hit in some environments. if (typeof value == 'string') { return value; } if (isArray(value)) { // Recursively convert values (susceptible to call stack limits). return arrayMap(value, baseToString) + ''; } if (isSymbol(value)) { return symbolToString ? symbolToString.call(value) : ''; } var result = (value + ''); return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } module.exports = baseToString; /***/ }), /***/ 27561: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var trimmedEndIndex = __webpack_require__(67990); /** Used to match leading whitespace. */ var reTrimStart = /^\s+/; /** * The base implementation of `_.trim`. * * @private * @param {string} string The string to trim. * @returns {string} Returns the trimmed string. */ function baseTrim(string) { return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '') : string; } module.exports = baseTrim; /***/ }), /***/ 7518: /***/ (function(module) { /** * The base implementation of `_.unary` without support for storing metadata. * * @private * @param {Function} func The function to cap arguments for. * @returns {Function} Returns the new capped function. */ function baseUnary(func) { return function(value) { return func(value); }; } module.exports = baseUnary; /***/ }), /***/ 45652: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var SetCache = __webpack_require__(88668), arrayIncludes = __webpack_require__(47443), arrayIncludesWith = __webpack_require__(1196), cacheHas = __webpack_require__(74757), createSet = __webpack_require__(23593), setToArray = __webpack_require__(21814); /** Used as the size to enable large array optimizations. */ var LARGE_ARRAY_SIZE = 200; /** * The base implementation of `_.uniqBy` without support for iteratee shorthands. * * @private * @param {Array} array The array to inspect. * @param {Function} [iteratee] The iteratee invoked per element. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new duplicate free array. */ function baseUniq(array, iteratee, comparator) { var index = -1, includes = arrayIncludes, length = array.length, isCommon = true, result = [], seen = result; if (comparator) { isCommon = false; includes = arrayIncludesWith; } else if (length >= LARGE_ARRAY_SIZE) { var set = iteratee ? null : createSet(array); if (set) { return setToArray(set); } isCommon = false; includes = cacheHas; seen = new SetCache; } else { seen = iteratee ? [] : result; } outer: while (++index < length) { var value = array[index], computed = iteratee ? iteratee(value) : value; value = (comparator || value !== 0) ? value : 0; if (isCommon && computed === computed) { var seenIndex = seen.length; while (seenIndex--) { if (seen[seenIndex] === computed) { continue outer; } } if (iteratee) { seen.push(computed); } result.push(value); } else if (!includes(seen, computed, comparator)) { if (seen !== result) { seen.push(computed); } result.push(value); } } return result; } module.exports = baseUniq; /***/ }), /***/ 74757: /***/ (function(module) { /** * Checks if a `cache` value for `key` exists. * * @private * @param {Object} cache The cache to query. * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function cacheHas(cache, key) { return cache.has(key); } module.exports = cacheHas; /***/ }), /***/ 71811: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var isArray = __webpack_require__(1469), isKey = __webpack_require__(15403), stringToPath = __webpack_require__(55514), toString = __webpack_require__(79833); /** * Casts `value` to a path array if it's not one. * * @private * @param {*} value The value to inspect. * @param {Object} [object] The object to query keys on. * @returns {Array} Returns the cast property path array. */ function castPath(value, object) { if (isArray(value)) { return value; } return isKey(value, object) ? [value] : stringToPath(toString(value)); } module.exports = castPath; /***/ }), /***/ 74318: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var Uint8Array = __webpack_require__(11149); /** * Creates a clone of `arrayBuffer`. * * @private * @param {ArrayBuffer} arrayBuffer The array buffer to clone. * @returns {ArrayBuffer} Returns the cloned array buffer. */ function cloneArrayBuffer(arrayBuffer) { var result = new arrayBuffer.constructor(arrayBuffer.byteLength); new Uint8Array(result).set(new Uint8Array(arrayBuffer)); return result; } module.exports = cloneArrayBuffer; /***/ }), /***/ 64626: /***/ (function(module, exports, __webpack_require__) { /* module decorator */ module = __webpack_require__.nmd(module); var root = __webpack_require__(55639); /** Detect free variable `exports`. */ var freeExports = true && exports && !exports.nodeType && exports; /** Detect free variable `module`. */ var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module; /** Detect the popular CommonJS extension `module.exports`. */ var moduleExports = freeModule && freeModule.exports === freeExports; /** Built-in value references. */ var Buffer = moduleExports ? root.Buffer : undefined, allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined; /** * Creates a clone of `buffer`. * * @private * @param {Buffer} buffer The buffer to clone. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Buffer} Returns the cloned buffer. */ function cloneBuffer(buffer, isDeep) { if (isDeep) { return buffer.slice(); } var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); buffer.copy(result); return result; } module.exports = cloneBuffer; /***/ }), /***/ 77133: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var cloneArrayBuffer = __webpack_require__(74318); /** * Creates a clone of `typedArray`. * * @private * @param {Object} typedArray The typed array to clone. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Object} Returns the cloned typed array. */ function cloneTypedArray(typedArray, isDeep) { var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); } module.exports = cloneTypedArray; /***/ }), /***/ 26393: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var isSymbol = __webpack_require__(33448); /** * Compares values to sort them in ascending order. * * @private * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {number} Returns the sort order indicator for `value`. */ function compareAscending(value, other) { if (value !== other) { var valIsDefined = value !== undefined, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol(value); var othIsDefined = other !== undefined, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol(other); if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) || (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) || (valIsNull && othIsDefined && othIsReflexive) || (!valIsDefined && othIsReflexive) || !valIsReflexive) { return 1; } if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) || (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) || (othIsNull && valIsDefined && valIsReflexive) || (!othIsDefined && valIsReflexive) || !othIsReflexive) { return -1; } } return 0; } module.exports = compareAscending; /***/ }), /***/ 85022: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var compareAscending = __webpack_require__(26393); /** * Used by `_.orderBy` to compare multiple properties of a value to another * and stable sort them. * * If `orders` is unspecified, all values are sorted in ascending order. Otherwise, * specify an order of "desc" for descending or "asc" for ascending sort order * of corresponding values. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {boolean[]|string[]} orders The order to sort by for each property. * @returns {number} Returns the sort order indicator for `object`. */ function compareMultiple(object, other, orders) { var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length; while (++index < length) { var result = compareAscending(objCriteria[index], othCriteria[index]); if (result) { if (index >= ordersLength) { return result; } var order = orders[index]; return result * (order == 'desc' ? -1 : 1); } } // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications // that causes it, under certain circumstances, to provide the same value for // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247 // for more details. // // This also ensures a stable sort in V8 and other engines. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details. return object.index - other.index; } module.exports = compareMultiple; /***/ }), /***/ 278: /***/ (function(module) { /** * Copies the values of `source` to `array`. * * @private * @param {Array} source The array to copy values from. * @param {Array} [array=[]] The array to copy values to. * @returns {Array} Returns `array`. */ function copyArray(source, array) { var index = -1, length = source.length; array || (array = Array(length)); while (++index < length) { array[index] = source[index]; } return array; } module.exports = copyArray; /***/ }), /***/ 98363: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var assignValue = __webpack_require__(34865), baseAssignValue = __webpack_require__(89465); /** * Copies properties of `source` to `object`. * * @private * @param {Object} source The object to copy properties from. * @param {Array} props The property identifiers to copy. * @param {Object} [object={}] The object to copy properties to. * @param {Function} [customizer] The function to customize copied values. * @returns {Object} Returns `object`. */ function copyObject(source, props, object, customizer) { var isNew = !object; object || (object = {}); var index = -1, length = props.length; while (++index < length) { var key = props[index]; var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined; if (newValue === undefined) { newValue = source[key]; } if (isNew) { baseAssignValue(object, key, newValue); } else { assignValue(object, key, newValue); } } return object; } module.exports = copyObject; /***/ }), /***/ 14429: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var root = __webpack_require__(55639); /** Used to detect overreaching core-js shims. */ var coreJsData = root['__core-js_shared__']; module.exports = coreJsData; /***/ }), /***/ 55189: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var arrayAggregator = __webpack_require__(44174), baseAggregator = __webpack_require__(81119), baseIteratee = __webpack_require__(67206), isArray = __webpack_require__(1469); /** * Creates a function like `_.groupBy`. * * @private * @param {Function} setter The function to set accumulator values. * @param {Function} [initializer] The accumulator object initializer. * @returns {Function} Returns the new aggregator function. */ function createAggregator(setter, initializer) { return function(collection, iteratee) { var func = isArray(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {}; return func(collection, setter, baseIteratee(iteratee, 2), accumulator); }; } module.exports = createAggregator; /***/ }), /***/ 21463: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseRest = __webpack_require__(5976), isIterateeCall = __webpack_require__(16612); /** * Creates a function like `_.assign`. * * @private * @param {Function} assigner The function to assign values. * @returns {Function} Returns the new assigner function. */ function createAssigner(assigner) { return baseRest(function(object, sources) { var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined, guard = length > 2 ? sources[2] : undefined; customizer = (assigner.length > 3 && typeof customizer == 'function') ? (length--, customizer) : undefined; if (guard && isIterateeCall(sources[0], sources[1], guard)) { customizer = length < 3 ? undefined : customizer; length = 1; } object = Object(object); while (++index < length) { var source = sources[index]; if (source) { assigner(object, source, index, customizer); } } return object; }); } module.exports = createAssigner; /***/ }), /***/ 99291: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var isArrayLike = __webpack_require__(98612); /** * Creates a `baseEach` or `baseEachRight` function. * * @private * @param {Function} eachFunc The function to iterate over a collection. * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Function} Returns the new base function. */ function createBaseEach(eachFunc, fromRight) { return function(collection, iteratee) { if (collection == null) { return collection; } if (!isArrayLike(collection)) { return eachFunc(collection, iteratee); } var length = collection.length, index = fromRight ? length : -1, iterable = Object(collection); while ((fromRight ? index-- : ++index < length)) { if (iteratee(iterable[index], index, iterable) === false) { break; } } return collection; }; } module.exports = createBaseEach; /***/ }), /***/ 25063: /***/ (function(module) { /** * Creates a base function for methods like `_.forIn` and `_.forOwn`. * * @private * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Function} Returns the new base function. */ function createBaseFor(fromRight) { return function(object, iteratee, keysFunc) { var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length; while (length--) { var key = props[fromRight ? length : ++index]; if (iteratee(iterable[key], key, iterable) === false) { break; } } return object; }; } module.exports = createBaseFor; /***/ }), /***/ 35393: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var arrayReduce = __webpack_require__(62663), deburr = __webpack_require__(53816), words = __webpack_require__(58748); /** Used to compose unicode capture groups. */ var rsApos = "['\u2019]"; /** Used to match apostrophes. */ var reApos = RegExp(rsApos, 'g'); /** * Creates a function like `_.camelCase`. * * @private * @param {Function} callback The function to combine each word. * @returns {Function} Returns the new compounder function. */ function createCompounder(callback) { return function(string) { return arrayReduce(words(deburr(string).replace(reApos, '')), callback, ''); }; } module.exports = createCompounder; /***/ }), /***/ 47445: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseRange = __webpack_require__(40098), isIterateeCall = __webpack_require__(16612), toFinite = __webpack_require__(18601); /** * Creates a `_.range` or `_.rangeRight` function. * * @private * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Function} Returns the new range function. */ function createRange(fromRight) { return function(start, end, step) { if (step && typeof step != 'number' && isIterateeCall(start, end, step)) { end = step = undefined; } // Ensure the sign of `-0` is preserved. start = toFinite(start); if (end === undefined) { end = start; start = 0; } else { end = toFinite(end); } step = step === undefined ? (start < end ? 1 : -1) : toFinite(step); return baseRange(start, end, step, fromRight); }; } module.exports = createRange; /***/ }), /***/ 23593: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var Set = __webpack_require__(58525), noop = __webpack_require__(50308), setToArray = __webpack_require__(21814); /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0; /** * Creates a set object of `values`. * * @private * @param {Array} values The values to add to the set. * @returns {Object} Returns the new set. */ var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) { return new Set(values); }; module.exports = createSet; /***/ }), /***/ 69389: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var basePropertyOf = __webpack_require__(18674); /** Used to map Latin Unicode letters to basic Latin letters. */ var deburredLetters = { // Latin-1 Supplement block. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', '\xc7': 'C', '\xe7': 'c', '\xd0': 'D', '\xf0': 'd', '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', '\xd1': 'N', '\xf1': 'n', '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', '\xc6': 'Ae', '\xe6': 'ae', '\xde': 'Th', '\xfe': 'th', '\xdf': 'ss', // Latin Extended-A block. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', '\u0134': 'J', '\u0135': 'j', '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', '\u0163': 't', '\u0165': 't', '\u0167': 't', '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', '\u0174': 'W', '\u0175': 'w', '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', '\u0132': 'IJ', '\u0133': 'ij', '\u0152': 'Oe', '\u0153': 'oe', '\u0149': "'n", '\u017f': 's' }; /** * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A * letters to basic Latin letters. * * @private * @param {string} letter The matched letter to deburr. * @returns {string} Returns the deburred letter. */ var deburrLetter = basePropertyOf(deburredLetters); module.exports = deburrLetter; /***/ }), /***/ 38777: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var getNative = __webpack_require__(10852); var defineProperty = (function() { try { var func = getNative(Object, 'defineProperty'); func({}, '', {}); return func; } catch (e) {} }()); module.exports = defineProperty; /***/ }), /***/ 67114: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var SetCache = __webpack_require__(88668), arraySome = __webpack_require__(82908), cacheHas = __webpack_require__(74757); /** Used to compose bitmasks for value comparisons. */ var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2; /** * A specialized version of `baseIsEqualDeep` for arrays with support for * partial deep comparisons. * * @private * @param {Array} array The array to compare. * @param {Array} other The other array to compare. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. * @param {Function} customizer The function to customize comparisons. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Object} stack Tracks traversed `array` and `other` objects. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. */ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length; if (arrLength != othLength && !(isPartial && othLength > arrLength)) { return false; } // Check that cyclic values are equal. var arrStacked = stack.get(array); var othStacked = stack.get(other); if (arrStacked && othStacked) { return arrStacked == other && othStacked == array; } var index = -1, result = true, seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined; stack.set(array, other); stack.set(other, array); // Ignore non-index properties. while (++index < arrLength) { var arrValue = array[index], othValue = other[index]; if (customizer) { var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack); } if (compared !== undefined) { if (compared) { continue; } result = false; break; } // Recursively compare arrays (susceptible to call stack limits). if (seen) { if (!arraySome(other, function(othValue, othIndex) { if (!cacheHas(seen, othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { return seen.push(othIndex); } })) { result = false; break; } } else if (!( arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack) )) { result = false; break; } } stack['delete'](array); stack['delete'](other); return result; } module.exports = equalArrays; /***/ }), /***/ 18351: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var Symbol = __webpack_require__(62705), Uint8Array = __webpack_require__(11149), eq = __webpack_require__(77813), equalArrays = __webpack_require__(67114), mapToArray = __webpack_require__(68776), setToArray = __webpack_require__(21814); /** Used to compose bitmasks for value comparisons. */ var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2; /** `Object#toString` result references. */ var boolTag = '[object Boolean]', dateTag = '[object Date]', errorTag = '[object Error]', mapTag = '[object Map]', numberTag = '[object Number]', regexpTag = '[object RegExp]', setTag = '[object Set]', stringTag = '[object String]', symbolTag = '[object Symbol]'; var arrayBufferTag = '[object ArrayBuffer]', dataViewTag = '[object DataView]'; /** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol ? Symbol.prototype : undefined, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; /** * A specialized version of `baseIsEqualDeep` for comparing objects of * the same `toStringTag`. * * **Note:** This function only supports comparing values with tags of * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {string} tag The `toStringTag` of the objects to compare. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. * @param {Function} customizer The function to customize comparisons. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Object} stack Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { switch (tag) { case dataViewTag: if ((object.byteLength != other.byteLength) || (object.byteOffset != other.byteOffset)) { return false; } object = object.buffer; other = other.buffer; case arrayBufferTag: if ((object.byteLength != other.byteLength) || !equalFunc(new Uint8Array(object), new Uint8Array(other))) { return false; } return true; case boolTag: case dateTag: case numberTag: // Coerce booleans to `1` or `0` and dates to milliseconds. // Invalid dates are coerced to `NaN`. return eq(+object, +other); case errorTag: return object.name == other.name && object.message == other.message; case regexpTag: case stringTag: // Coerce regexes to strings and treat strings, primitives and objects, // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring // for more details. return object == (other + ''); case mapTag: var convert = mapToArray; case setTag: var isPartial = bitmask & COMPARE_PARTIAL_FLAG; convert || (convert = setToArray); if (object.size != other.size && !isPartial) { return false; } // Assume cyclic values are equal. var stacked = stack.get(object); if (stacked) { return stacked == other; } bitmask |= COMPARE_UNORDERED_FLAG; // Recursively compare objects (susceptible to call stack limits). stack.set(object, other); var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); stack['delete'](object); return result; case symbolTag: if (symbolValueOf) { return symbolValueOf.call(object) == symbolValueOf.call(other); } } return false; } module.exports = equalByTag; /***/ }), /***/ 16096: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var getAllKeys = __webpack_require__(58234); /** Used to compose bitmasks for value comparisons. */ var COMPARE_PARTIAL_FLAG = 1; /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * A specialized version of `baseIsEqualDeep` for objects with support for * partial deep comparisons. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. * @param {Function} customizer The function to customize comparisons. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Object} stack Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length; if (objLength != othLength && !isPartial) { return false; } var index = objLength; while (index--) { var key = objProps[index]; if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { return false; } } // Check that cyclic values are equal. var objStacked = stack.get(object); var othStacked = stack.get(other); if (objStacked && othStacked) { return objStacked == other && othStacked == object; } var result = true; stack.set(object, other); stack.set(other, object); var skipCtor = isPartial; while (++index < objLength) { key = objProps[index]; var objValue = object[key], othValue = other[key]; if (customizer) { var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack); } // Recursively compare objects (susceptible to call stack limits). if (!(compared === undefined ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) : compared )) { result = false; break; } skipCtor || (skipCtor = key == 'constructor'); } if (result && !skipCtor) { var objCtor = object.constructor, othCtor = other.constructor; // Non `Object` object instances with different constructors are not equal. if (objCtor != othCtor && ('constructor' in object && 'constructor' in other) && !(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) { result = false; } } stack['delete'](object); stack['delete'](other); return result; } module.exports = equalObjects; /***/ }), /***/ 31957: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { /** Detect free variable `global` from Node.js. */ var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g; module.exports = freeGlobal; /***/ }), /***/ 58234: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseGetAllKeys = __webpack_require__(68866), getSymbols = __webpack_require__(99551), keys = __webpack_require__(3674); /** * Creates an array of own enumerable property names and symbols of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names and symbols. */ function getAllKeys(object) { return baseGetAllKeys(object, keys, getSymbols); } module.exports = getAllKeys; /***/ }), /***/ 46904: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseGetAllKeys = __webpack_require__(68866), getSymbolsIn = __webpack_require__(51442), keysIn = __webpack_require__(81704); /** * Creates an array of own and inherited enumerable property names and * symbols of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names and symbols. */ function getAllKeysIn(object) { return baseGetAllKeys(object, keysIn, getSymbolsIn); } module.exports = getAllKeysIn; /***/ }), /***/ 45050: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var isKeyable = __webpack_require__(37019); /** * Gets the data for `map`. * * @private * @param {Object} map The map to query. * @param {string} key The reference key. * @returns {*} Returns the map data. */ function getMapData(map, key) { var data = map.__data__; return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map; } module.exports = getMapData; /***/ }), /***/ 1499: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var isStrictComparable = __webpack_require__(89162), keys = __webpack_require__(3674); /** * Gets the property names, values, and compare flags of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the match data of `object`. */ function getMatchData(object) { var result = keys(object), length = result.length; while (length--) { var key = result[length], value = object[key]; result[length] = [key, value, isStrictComparable(value)]; } return result; } module.exports = getMatchData; /***/ }), /***/ 10852: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseIsNative = __webpack_require__(28458), getValue = __webpack_require__(47801); /** * Gets the native function at `key` of `object`. * * @private * @param {Object} object The object to query. * @param {string} key The key of the method to get. * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { var value = getValue(object, key); return baseIsNative(value) ? value : undefined; } module.exports = getNative; /***/ }), /***/ 85924: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var overArg = __webpack_require__(5569); /** Built-in value references. */ var getPrototype = overArg(Object.getPrototypeOf, Object); module.exports = getPrototype; /***/ }), /***/ 89607: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var Symbol = __webpack_require__(62705); /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var nativeObjectToString = objectProto.toString; /** Built-in value references. */ var symToStringTag = Symbol ? Symbol.toStringTag : undefined; /** * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. * * @private * @param {*} value The value to query. * @returns {string} Returns the raw `toStringTag`. */ function getRawTag(value) { var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag]; try { value[symToStringTag] = undefined; var unmasked = true; } catch (e) {} var result = nativeObjectToString.call(value); if (unmasked) { if (isOwn) { value[symToStringTag] = tag; } else { delete value[symToStringTag]; } } return result; } module.exports = getRawTag; /***/ }), /***/ 99551: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var arrayFilter = __webpack_require__(34963), stubArray = __webpack_require__(70479); /** Used for built-in method references. */ var objectProto = Object.prototype; /** Built-in value references. */ var propertyIsEnumerable = objectProto.propertyIsEnumerable; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeGetSymbols = Object.getOwnPropertySymbols; /** * Creates an array of the own enumerable symbols of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of symbols. */ var getSymbols = !nativeGetSymbols ? stubArray : function(object) { if (object == null) { return []; } object = Object(object); return arrayFilter(nativeGetSymbols(object), function(symbol) { return propertyIsEnumerable.call(object, symbol); }); }; module.exports = getSymbols; /***/ }), /***/ 51442: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var arrayPush = __webpack_require__(62488), getPrototype = __webpack_require__(85924), getSymbols = __webpack_require__(99551), stubArray = __webpack_require__(70479); /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeGetSymbols = Object.getOwnPropertySymbols; /** * Creates an array of the own and inherited enumerable symbols of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of symbols. */ var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { var result = []; while (object) { arrayPush(result, getSymbols(object)); object = getPrototype(object); } return result; }; module.exports = getSymbolsIn; /***/ }), /***/ 64160: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var DataView = __webpack_require__(18552), Map = __webpack_require__(57071), Promise = __webpack_require__(53818), Set = __webpack_require__(58525), WeakMap = __webpack_require__(70577), baseGetTag = __webpack_require__(44239), toSource = __webpack_require__(80346); /** `Object#toString` result references. */ var mapTag = '[object Map]', objectTag = '[object Object]', promiseTag = '[object Promise]', setTag = '[object Set]', weakMapTag = '[object WeakMap]'; var dataViewTag = '[object DataView]'; /** Used to detect maps, sets, and weakmaps. */ var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap); /** * Gets the `toStringTag` of `value`. * * @private * @param {*} value The value to query. * @returns {string} Returns the `toStringTag`. */ var getTag = baseGetTag; // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || (Map && getTag(new Map) != mapTag) || (Promise && getTag(Promise.resolve()) != promiseTag) || (Set && getTag(new Set) != setTag) || (WeakMap && getTag(new WeakMap) != weakMapTag)) { getTag = function(value) { var result = baseGetTag(value), Ctor = result == objectTag ? value.constructor : undefined, ctorString = Ctor ? toSource(Ctor) : ''; if (ctorString) { switch (ctorString) { case dataViewCtorString: return dataViewTag; case mapCtorString: return mapTag; case promiseCtorString: return promiseTag; case setCtorString: return setTag; case weakMapCtorString: return weakMapTag; } } return result; }; } module.exports = getTag; /***/ }), /***/ 47801: /***/ (function(module) { /** * Gets the value at `key` of `object`. * * @private * @param {Object} [object] The object to query. * @param {string} key The key of the property to get. * @returns {*} Returns the property value. */ function getValue(object, key) { return object == null ? undefined : object[key]; } module.exports = getValue; /***/ }), /***/ 222: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var castPath = __webpack_require__(71811), isArguments = __webpack_require__(1025), isArray = __webpack_require__(1469), isIndex = __webpack_require__(65776), isLength = __webpack_require__(41780), toKey = __webpack_require__(40327); /** * Checks if `path` exists on `object`. * * @private * @param {Object} object The object to query. * @param {Array|string} path The path to check. * @param {Function} hasFunc The function to check properties. * @returns {boolean} Returns `true` if `path` exists, else `false`. */ function hasPath(object, path, hasFunc) { path = castPath(path, object); var index = -1, length = path.length, result = false; while (++index < length) { var key = toKey(path[index]); if (!(result = object != null && hasFunc(object, key))) { break; } object = object[key]; } if (result || ++index != length) { return result; } length = object == null ? 0 : object.length; return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object)); } module.exports = hasPath; /***/ }), /***/ 93157: /***/ (function(module) { /** Used to detect strings that need a more robust regexp to match words. */ var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; /** * Checks if `string` contains a word composed of Unicode symbols. * * @private * @param {string} string The string to inspect. * @returns {boolean} Returns `true` if a word is found, else `false`. */ function hasUnicodeWord(string) { return reHasUnicodeWord.test(string); } module.exports = hasUnicodeWord; /***/ }), /***/ 51789: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var nativeCreate = __webpack_require__(94536); /** * Removes all key-value entries from the hash. * * @private * @name clear * @memberOf Hash */ function hashClear() { this.__data__ = nativeCreate ? nativeCreate(null) : {}; this.size = 0; } module.exports = hashClear; /***/ }), /***/ 80401: /***/ (function(module) { /** * Removes `key` and its value from the hash. * * @private * @name delete * @memberOf Hash * @param {Object} hash The hash to modify. * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function hashDelete(key) { var result = this.has(key) && delete this.__data__[key]; this.size -= result ? 1 : 0; return result; } module.exports = hashDelete; /***/ }), /***/ 57667: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var nativeCreate = __webpack_require__(94536); /** Used to stand-in for `undefined` hash values. */ var HASH_UNDEFINED = '__lodash_hash_undefined__'; /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Gets the hash value for `key`. * * @private * @name get * @memberOf Hash * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function hashGet(key) { var data = this.__data__; if (nativeCreate) { var result = data[key]; return result === HASH_UNDEFINED ? undefined : result; } return hasOwnProperty.call(data, key) ? data[key] : undefined; } module.exports = hashGet; /***/ }), /***/ 21327: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var nativeCreate = __webpack_require__(94536); /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Checks if a hash value for `key` exists. * * @private * @name has * @memberOf Hash * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function hashHas(key) { var data = this.__data__; return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key); } module.exports = hashHas; /***/ }), /***/ 81866: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var nativeCreate = __webpack_require__(94536); /** Used to stand-in for `undefined` hash values. */ var HASH_UNDEFINED = '__lodash_hash_undefined__'; /** * Sets the hash `key` to `value`. * * @private * @name set * @memberOf Hash * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the hash instance. */ function hashSet(key, value) { var data = this.__data__; this.size += this.has(key) ? 0 : 1; data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; return this; } module.exports = hashSet; /***/ }), /***/ 38517: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseCreate = __webpack_require__(3118), getPrototype = __webpack_require__(85924), isPrototype = __webpack_require__(25726); /** * Initializes an object clone. * * @private * @param {Object} object The object to clone. * @returns {Object} Returns the initialized clone. */ function initCloneObject(object) { return (typeof object.constructor == 'function' && !isPrototype(object)) ? baseCreate(getPrototype(object)) : {}; } module.exports = initCloneObject; /***/ }), /***/ 37285: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var Symbol = __webpack_require__(62705), isArguments = __webpack_require__(1025), isArray = __webpack_require__(1469); /** Built-in value references. */ var spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined; /** * Checks if `value` is a flattenable `arguments` object or array. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. */ function isFlattenable(value) { return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]); } module.exports = isFlattenable; /***/ }), /***/ 65776: /***/ (function(module) { /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; /** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; /** * Checks if `value` is a valid array-like index. * * @private * @param {*} value The value to check. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. */ function isIndex(value, length) { var type = typeof value; length = length == null ? MAX_SAFE_INTEGER : length; return !!length && (type == 'number' || (type != 'symbol' && reIsUint.test(value))) && (value > -1 && value % 1 == 0 && value < length); } module.exports = isIndex; /***/ }), /***/ 16612: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var eq = __webpack_require__(77813), isArrayLike = __webpack_require__(98612), isIndex = __webpack_require__(65776), isObject = __webpack_require__(13218); /** * Checks if the given arguments are from an iteratee call. * * @private * @param {*} value The potential iteratee value argument. * @param {*} index The potential iteratee index or key argument. * @param {*} object The potential iteratee object argument. * @returns {boolean} Returns `true` if the arguments are from an iteratee call, * else `false`. */ function isIterateeCall(value, index, object) { if (!isObject(object)) { return false; } var type = typeof index; if (type == 'number' ? (isArrayLike(object) && isIndex(index, object.length)) : (type == 'string' && index in object) ) { return eq(object[index], value); } return false; } module.exports = isIterateeCall; /***/ }), /***/ 15403: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var isArray = __webpack_require__(1469), isSymbol = __webpack_require__(33448); /** Used to match property names within property paths. */ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/; /** * Checks if `value` is a property name and not a property path. * * @private * @param {*} value The value to check. * @param {Object} [object] The object to query keys on. * @returns {boolean} Returns `true` if `value` is a property name, else `false`. */ function isKey(value, object) { if (isArray(value)) { return false; } var type = typeof value; if (type == 'number' || type == 'symbol' || type == 'boolean' || value == null || isSymbol(value)) { return true; } return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || (object != null && value in Object(object)); } module.exports = isKey; /***/ }), /***/ 37019: /***/ (function(module) { /** * Checks if `value` is suitable for use as unique object key. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is suitable, else `false`. */ function isKeyable(value) { var type = typeof value; return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') ? (value !== '__proto__') : (value === null); } module.exports = isKeyable; /***/ }), /***/ 15346: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var coreJsData = __webpack_require__(14429); /** Used to detect methods masquerading as native. */ var maskSrcKey = (function() { var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); return uid ? ('Symbol(src)_1.' + uid) : ''; }()); /** * Checks if `func` has its source masked. * * @private * @param {Function} func The function to check. * @returns {boolean} Returns `true` if `func` is masked, else `false`. */ function isMasked(func) { return !!maskSrcKey && (maskSrcKey in func); } module.exports = isMasked; /***/ }), /***/ 25726: /***/ (function(module) { /** Used for built-in method references. */ var objectProto = Object.prototype; /** * Checks if `value` is likely a prototype object. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. */ function isPrototype(value) { var Ctor = value && value.constructor, proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; return value === proto; } module.exports = isPrototype; /***/ }), /***/ 89162: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var isObject = __webpack_require__(13218); /** * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` if suitable for strict * equality comparisons, else `false`. */ function isStrictComparable(value) { return value === value && !isObject(value); } module.exports = isStrictComparable; /***/ }), /***/ 27040: /***/ (function(module) { /** * Removes all key-value entries from the list cache. * * @private * @name clear * @memberOf ListCache */ function listCacheClear() { this.__data__ = []; this.size = 0; } module.exports = listCacheClear; /***/ }), /***/ 14125: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var assocIndexOf = __webpack_require__(18470); /** Used for built-in method references. */ var arrayProto = Array.prototype; /** Built-in value references. */ var splice = arrayProto.splice; /** * Removes `key` and its value from the list cache. * * @private * @name delete * @memberOf ListCache * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function listCacheDelete(key) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { return false; } var lastIndex = data.length - 1; if (index == lastIndex) { data.pop(); } else { splice.call(data, index, 1); } --this.size; return true; } module.exports = listCacheDelete; /***/ }), /***/ 82117: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var assocIndexOf = __webpack_require__(18470); /** * Gets the list cache value for `key`. * * @private * @name get * @memberOf ListCache * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function listCacheGet(key) { var data = this.__data__, index = assocIndexOf(data, key); return index < 0 ? undefined : data[index][1]; } module.exports = listCacheGet; /***/ }), /***/ 67518: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var assocIndexOf = __webpack_require__(18470); /** * Checks if a list cache value for `key` exists. * * @private * @name has * @memberOf ListCache * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function listCacheHas(key) { return assocIndexOf(this.__data__, key) > -1; } module.exports = listCacheHas; /***/ }), /***/ 54705: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var assocIndexOf = __webpack_require__(18470); /** * Sets the list cache `key` to `value`. * * @private * @name set * @memberOf ListCache * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the list cache instance. */ function listCacheSet(key, value) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { ++this.size; data.push([key, value]); } else { data[index][1] = value; } return this; } module.exports = listCacheSet; /***/ }), /***/ 24785: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var Hash = __webpack_require__(1989), ListCache = __webpack_require__(38407), Map = __webpack_require__(57071); /** * Removes all key-value entries from the map. * * @private * @name clear * @memberOf MapCache */ function mapCacheClear() { this.size = 0; this.__data__ = { 'hash': new Hash, 'map': new (Map || ListCache), 'string': new Hash }; } module.exports = mapCacheClear; /***/ }), /***/ 11285: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var getMapData = __webpack_require__(45050); /** * Removes `key` and its value from the map. * * @private * @name delete * @memberOf MapCache * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function mapCacheDelete(key) { var result = getMapData(this, key)['delete'](key); this.size -= result ? 1 : 0; return result; } module.exports = mapCacheDelete; /***/ }), /***/ 96000: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var getMapData = __webpack_require__(45050); /** * Gets the map value for `key`. * * @private * @name get * @memberOf MapCache * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function mapCacheGet(key) { return getMapData(this, key).get(key); } module.exports = mapCacheGet; /***/ }), /***/ 49916: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var getMapData = __webpack_require__(45050); /** * Checks if a map value for `key` exists. * * @private * @name has * @memberOf MapCache * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function mapCacheHas(key) { return getMapData(this, key).has(key); } module.exports = mapCacheHas; /***/ }), /***/ 95265: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var getMapData = __webpack_require__(45050); /** * Sets the map `key` to `value`. * * @private * @name set * @memberOf MapCache * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the map cache instance. */ function mapCacheSet(key, value) { var data = getMapData(this, key), size = data.size; data.set(key, value); this.size += data.size == size ? 0 : 1; return this; } module.exports = mapCacheSet; /***/ }), /***/ 68776: /***/ (function(module) { /** * Converts `map` to its key-value pairs. * * @private * @param {Object} map The map to convert. * @returns {Array} Returns the key-value pairs. */ function mapToArray(map) { var index = -1, result = Array(map.size); map.forEach(function(value, key) { result[++index] = [key, value]; }); return result; } module.exports = mapToArray; /***/ }), /***/ 42634: /***/ (function(module) { /** * A specialized version of `matchesProperty` for source values suitable * for strict equality comparisons, i.e. `===`. * * @private * @param {string} key The key of the property to get. * @param {*} srcValue The value to match. * @returns {Function} Returns the new spec function. */ function matchesStrictComparable(key, srcValue) { return function(object) { if (object == null) { return false; } return object[key] === srcValue && (srcValue !== undefined || (key in Object(object))); }; } module.exports = matchesStrictComparable; /***/ }), /***/ 24523: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var memoize = __webpack_require__(88306); /** Used as the maximum memoize cache size. */ var MAX_MEMOIZE_SIZE = 500; /** * A specialized version of `_.memoize` which clears the memoized function's * cache when it exceeds `MAX_MEMOIZE_SIZE`. * * @private * @param {Function} func The function to have its output memoized. * @returns {Function} Returns the new memoized function. */ function memoizeCapped(func) { var result = memoize(func, function(key) { if (cache.size === MAX_MEMOIZE_SIZE) { cache.clear(); } return key; }); var cache = result.cache; return result; } module.exports = memoizeCapped; /***/ }), /***/ 94536: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var getNative = __webpack_require__(10852); /* Built-in method references that are verified to be native. */ var nativeCreate = getNative(Object, 'create'); module.exports = nativeCreate; /***/ }), /***/ 86916: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var overArg = __webpack_require__(5569); /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeKeys = overArg(Object.keys, Object); module.exports = nativeKeys; /***/ }), /***/ 33498: /***/ (function(module) { /** * This function is like * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) * except that it includes inherited enumerable properties. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function nativeKeysIn(object) { var result = []; if (object != null) { for (var key in Object(object)) { result.push(key); } } return result; } module.exports = nativeKeysIn; /***/ }), /***/ 31167: /***/ (function(module, exports, __webpack_require__) { /* module decorator */ module = __webpack_require__.nmd(module); var freeGlobal = __webpack_require__(31957); /** Detect free variable `exports`. */ var freeExports = true && exports && !exports.nodeType && exports; /** Detect free variable `module`. */ var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module; /** Detect the popular CommonJS extension `module.exports`. */ var moduleExports = freeModule && freeModule.exports === freeExports; /** Detect free variable `process` from Node.js. */ var freeProcess = moduleExports && freeGlobal.process; /** Used to access faster Node.js helpers. */ var nodeUtil = (function() { try { // Use `util.types` for Node.js 10+. var types = freeModule && freeModule.require && freeModule.require('util').types; if (types) { return types; } // Legacy `process.binding('util')` for Node.js < 10. return freeProcess && freeProcess.binding && freeProcess.binding('util'); } catch (e) {} }()); module.exports = nodeUtil; /***/ }), /***/ 2333: /***/ (function(module) { /** Used for built-in method references. */ var objectProto = Object.prototype; /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var nativeObjectToString = objectProto.toString; /** * Converts `value` to a string using `Object.prototype.toString`. * * @private * @param {*} value The value to convert. * @returns {string} Returns the converted string. */ function objectToString(value) { return nativeObjectToString.call(value); } module.exports = objectToString; /***/ }), /***/ 5569: /***/ (function(module) { /** * Creates a unary function that invokes `func` with its argument transformed. * * @private * @param {Function} func The function to wrap. * @param {Function} transform The argument transform. * @returns {Function} Returns the new function. */ function overArg(func, transform) { return function(arg) { return func(transform(arg)); }; } module.exports = overArg; /***/ }), /***/ 45357: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var apply = __webpack_require__(96874); /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeMax = Math.max; /** * A specialized version of `baseRest` which transforms the rest array. * * @private * @param {Function} func The function to apply a rest parameter to. * @param {number} [start=func.length-1] The start position of the rest parameter. * @param {Function} transform The rest array transform. * @returns {Function} Returns the new function. */ function overRest(func, start, transform) { start = nativeMax(start === undefined ? (func.length - 1) : start, 0); return function() { var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array(length); while (++index < length) { array[index] = args[start + index]; } index = -1; var otherArgs = Array(start + 1); while (++index < start) { otherArgs[index] = args[index]; } otherArgs[start] = transform(array); return apply(func, this, otherArgs); }; } module.exports = overRest; /***/ }), /***/ 55639: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var freeGlobal = __webpack_require__(31957); /** Detect free variable `self`. */ var freeSelf = typeof self == 'object' && self && self.Object === Object && self; /** Used as a reference to the global object. */ var root = freeGlobal || freeSelf || Function('return this')(); module.exports = root; /***/ }), /***/ 36390: /***/ (function(module) { /** * Gets the value at `key`, unless `key` is "__proto__" or "constructor". * * @private * @param {Object} object The object to query. * @param {string} key The key of the property to get. * @returns {*} Returns the property value. */ function safeGet(object, key) { if (key === 'constructor' && typeof object[key] === 'function') { return; } if (key == '__proto__') { return; } return object[key]; } module.exports = safeGet; /***/ }), /***/ 90619: /***/ (function(module) { /** Used to stand-in for `undefined` hash values. */ var HASH_UNDEFINED = '__lodash_hash_undefined__'; /** * Adds `value` to the array cache. * * @private * @name add * @memberOf SetCache * @alias push * @param {*} value The value to cache. * @returns {Object} Returns the cache instance. */ function setCacheAdd(value) { this.__data__.set(value, HASH_UNDEFINED); return this; } module.exports = setCacheAdd; /***/ }), /***/ 72385: /***/ (function(module) { /** * Checks if `value` is in the array cache. * * @private * @name has * @memberOf SetCache * @param {*} value The value to search for. * @returns {number} Returns `true` if `value` is found, else `false`. */ function setCacheHas(value) { return this.__data__.has(value); } module.exports = setCacheHas; /***/ }), /***/ 21814: /***/ (function(module) { /** * Converts `set` to an array of its values. * * @private * @param {Object} set The set to convert. * @returns {Array} Returns the values. */ function setToArray(set) { var index = -1, result = Array(set.size); set.forEach(function(value) { result[++index] = value; }); return result; } module.exports = setToArray; /***/ }), /***/ 30061: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseSetToString = __webpack_require__(56560), shortOut = __webpack_require__(21275); /** * Sets the `toString` method of `func` to return `string`. * * @private * @param {Function} func The function to modify. * @param {Function} string The `toString` result. * @returns {Function} Returns `func`. */ var setToString = shortOut(baseSetToString); module.exports = setToString; /***/ }), /***/ 21275: /***/ (function(module) { /** Used to detect hot functions by number of calls within a span of milliseconds. */ var HOT_COUNT = 800, HOT_SPAN = 16; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeNow = Date.now; /** * Creates a function that'll short out and invoke `identity` instead * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` * milliseconds. * * @private * @param {Function} func The function to restrict. * @returns {Function} Returns the new shortable function. */ function shortOut(func) { var count = 0, lastCalled = 0; return function() { var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled); lastCalled = stamp; if (remaining > 0) { if (++count >= HOT_COUNT) { return arguments[0]; } } else { count = 0; } return func.apply(undefined, arguments); }; } module.exports = shortOut; /***/ }), /***/ 37465: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var ListCache = __webpack_require__(38407); /** * Removes all key-value entries from the stack. * * @private * @name clear * @memberOf Stack */ function stackClear() { this.__data__ = new ListCache; this.size = 0; } module.exports = stackClear; /***/ }), /***/ 63779: /***/ (function(module) { /** * Removes `key` and its value from the stack. * * @private * @name delete * @memberOf Stack * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function stackDelete(key) { var data = this.__data__, result = data['delete'](key); this.size = data.size; return result; } module.exports = stackDelete; /***/ }), /***/ 67599: /***/ (function(module) { /** * Gets the stack value for `key`. * * @private * @name get * @memberOf Stack * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function stackGet(key) { return this.__data__.get(key); } module.exports = stackGet; /***/ }), /***/ 44758: /***/ (function(module) { /** * Checks if a stack value for `key` exists. * * @private * @name has * @memberOf Stack * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function stackHas(key) { return this.__data__.has(key); } module.exports = stackHas; /***/ }), /***/ 34309: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var ListCache = __webpack_require__(38407), Map = __webpack_require__(57071), MapCache = __webpack_require__(83369); /** Used as the size to enable large array optimizations. */ var LARGE_ARRAY_SIZE = 200; /** * Sets the stack `key` to `value`. * * @private * @name set * @memberOf Stack * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the stack cache instance. */ function stackSet(key, value) { var data = this.__data__; if (data instanceof ListCache) { var pairs = data.__data__; if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { pairs.push([key, value]); this.size = ++data.size; return this; } data = this.__data__ = new MapCache(pairs); } data.set(key, value); this.size = data.size; return this; } module.exports = stackSet; /***/ }), /***/ 42351: /***/ (function(module) { /** * A specialized version of `_.indexOf` which performs strict equality * comparisons of values, i.e. `===`. * * @private * @param {Array} array The array to inspect. * @param {*} value The value to search for. * @param {number} fromIndex The index to search from. * @returns {number} Returns the index of the matched value, else `-1`. */ function strictIndexOf(array, value, fromIndex) { var index = fromIndex - 1, length = array.length; while (++index < length) { if (array[index] === value) { return index; } } return -1; } module.exports = strictIndexOf; /***/ }), /***/ 55514: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var memoizeCapped = __webpack_require__(24523); /** Used to match property names within property paths. */ var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; /** Used to match backslashes in property paths. */ var reEscapeChar = /\\(\\)?/g; /** * Converts `string` to a property path array. * * @private * @param {string} string The string to convert. * @returns {Array} Returns the property path array. */ var stringToPath = memoizeCapped(function(string) { var result = []; if (string.charCodeAt(0) === 46 /* . */) { result.push(''); } string.replace(rePropName, function(match, number, quote, subString) { result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match)); }); return result; }); module.exports = stringToPath; /***/ }), /***/ 40327: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var isSymbol = __webpack_require__(33448); /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0; /** * Converts `value` to a string key if it's not a string or symbol. * * @private * @param {*} value The value to inspect. * @returns {string|symbol} Returns the key. */ function toKey(value) { if (typeof value == 'string' || isSymbol(value)) { return value; } var result = (value + ''); return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } module.exports = toKey; /***/ }), /***/ 80346: /***/ (function(module) { /** Used for built-in method references. */ var funcProto = Function.prototype; /** Used to resolve the decompiled source of functions. */ var funcToString = funcProto.toString; /** * Converts `func` to its source code. * * @private * @param {Function} func The function to convert. * @returns {string} Returns the source code. */ function toSource(func) { if (func != null) { try { return funcToString.call(func); } catch (e) {} try { return (func + ''); } catch (e) {} } return ''; } module.exports = toSource; /***/ }), /***/ 67990: /***/ (function(module) { /** Used to match a single whitespace character. */ var reWhitespace = /\s/; /** * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace * character of `string`. * * @private * @param {string} string The string to inspect. * @returns {number} Returns the index of the last non-whitespace character. */ function trimmedEndIndex(string) { var index = string.length; while (index-- && reWhitespace.test(string.charAt(index))) {} return index; } module.exports = trimmedEndIndex; /***/ }), /***/ 2757: /***/ (function(module) { /** Used to compose unicode character classes. */ var rsAstralRange = '\\ud800-\\udfff', rsComboMarksRange = '\\u0300-\\u036f', reComboHalfMarksRange = '\\ufe20-\\ufe2f', rsComboSymbolsRange = '\\u20d0-\\u20ff', rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, rsDingbatRange = '\\u2700-\\u27bf', rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', rsPunctuationRange = '\\u2000-\\u206f', rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000', rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', rsVarRange = '\\ufe0e\\ufe0f', rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; /** Used to compose unicode capture groups. */ var rsApos = "['\u2019]", rsBreak = '[' + rsBreakRange + ']', rsCombo = '[' + rsComboRange + ']', rsDigits = '\\d+', rsDingbat = '[' + rsDingbatRange + ']', rsLower = '[' + rsLowerRange + ']', rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', rsFitz = '\\ud83c[\\udffb-\\udfff]', rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', rsNonAstral = '[^' + rsAstralRange + ']', rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', rsUpper = '[' + rsUpperRange + ']', rsZWJ = '\\u200d'; /** Used to compose unicode regexes. */ var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')', rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')', rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?', rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?', reOptMod = rsModifier + '?', rsOptVar = '[' + rsVarRange + ']?', rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])', rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])', rsSeq = rsOptVar + reOptMod + rsOptJoin, rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq; /** Used to match complex or compound words. */ var reUnicodeWord = RegExp([ rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')', rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower, rsUpper + '+' + rsOptContrUpper, rsOrdUpper, rsOrdLower, rsDigits, rsEmoji ].join('|'), 'g'); /** * Splits a Unicode `string` into an array of its words. * * @private * @param {string} The string to inspect. * @returns {Array} Returns the words of `string`. */ function unicodeWords(string) { return string.match(reUnicodeWord) || []; } module.exports = unicodeWords; /***/ }), /***/ 8400: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseSlice = __webpack_require__(14259), isIterateeCall = __webpack_require__(16612), toInteger = __webpack_require__(40554); /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeCeil = Math.ceil, nativeMax = Math.max; /** * Creates an array of elements split into groups the length of `size`. * If `array` can't be split evenly, the final chunk will be the remaining * elements. * * @static * @memberOf _ * @since 3.0.0 * @category Array * @param {Array} array The array to process. * @param {number} [size=1] The length of each chunk * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Array} Returns the new array of chunks. * @example * * _.chunk(['a', 'b', 'c', 'd'], 2); * // => [['a', 'b'], ['c', 'd']] * * _.chunk(['a', 'b', 'c', 'd'], 3); * // => [['a', 'b', 'c'], ['d']] */ function chunk(array, size, guard) { if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) { size = 1; } else { size = nativeMax(toInteger(size), 0); } var length = array == null ? 0 : array.length; if (!length || size < 1) { return []; } var index = 0, resIndex = 0, result = Array(nativeCeil(length / size)); while (index < length) { result[resIndex++] = baseSlice(array, index, (index += size)); } return result; } module.exports = chunk; /***/ }), /***/ 75703: /***/ (function(module) { /** * Creates a function that returns `value`. * * @static * @memberOf _ * @since 2.4.0 * @category Util * @param {*} value The value to return from the new function. * @returns {Function} Returns the new constant function. * @example * * var objects = _.times(2, _.constant({ 'a': 1 })); * * console.log(objects); * // => [{ 'a': 1 }, { 'a': 1 }] * * console.log(objects[0] === objects[1]); * // => true */ function constant(value) { return function() { return value; }; } module.exports = constant; /***/ }), /***/ 23279: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var isObject = __webpack_require__(13218), now = __webpack_require__(7771), toNumber = __webpack_require__(14841); /** Error message constants. */ var FUNC_ERROR_TEXT = 'Expected a function'; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeMax = Math.max, nativeMin = Math.min; /** * Creates a debounced function that delays invoking `func` until after `wait` * milliseconds have elapsed since the last time the debounced function was * invoked. The debounced function comes with a `cancel` method to cancel * delayed `func` invocations and a `flush` method to immediately invoke them. * Provide `options` to indicate whether `func` should be invoked on the * leading and/or trailing edge of the `wait` timeout. The `func` is invoked * with the last arguments provided to the debounced function. Subsequent * calls to the debounced function return the result of the last `func` * invocation. * * **Note:** If `leading` and `trailing` options are `true`, `func` is * invoked on the trailing edge of the timeout only if the debounced function * is invoked more than once during the `wait` timeout. * * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred * until to the next tick, similar to `setTimeout` with a timeout of `0`. * * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) * for details over the differences between `_.debounce` and `_.throttle`. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to debounce. * @param {number} [wait=0] The number of milliseconds to delay. * @param {Object} [options={}] The options object. * @param {boolean} [options.leading=false] * Specify invoking on the leading edge of the timeout. * @param {number} [options.maxWait] * The maximum time `func` is allowed to be delayed before it's invoked. * @param {boolean} [options.trailing=true] * Specify invoking on the trailing edge of the timeout. * @returns {Function} Returns the new debounced function. * @example * * // Avoid costly calculations while the window size is in flux. * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); * * // Invoke `sendMail` when clicked, debouncing subsequent calls. * jQuery(element).on('click', _.debounce(sendMail, 300, { * 'leading': true, * 'trailing': false * })); * * // Ensure `batchLog` is invoked once after 1 second of debounced calls. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); * var source = new EventSource('/stream'); * jQuery(source).on('message', debounced); * * // Cancel the trailing debounced invocation. * jQuery(window).on('popstate', debounced.cancel); */ function debounce(func, wait, options) { var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true; if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } wait = toNumber(wait) || 0; if (isObject(options)) { leading = !!options.leading; maxing = 'maxWait' in options; maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; trailing = 'trailing' in options ? !!options.trailing : trailing; } function invokeFunc(time) { var args = lastArgs, thisArg = lastThis; lastArgs = lastThis = undefined; lastInvokeTime = time; result = func.apply(thisArg, args); return result; } function leadingEdge(time) { // Reset any `maxWait` timer. lastInvokeTime = time; // Start the timer for the trailing edge. timerId = setTimeout(timerExpired, wait); // Invoke the leading edge. return leading ? invokeFunc(time) : result; } function remainingWait(time) { var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall; return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting; } function shouldInvoke(time) { var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime; // Either this is the first call, activity has stopped and we're at the // trailing edge, the system time has gone backwards and we're treating // it as the trailing edge, or we've hit the `maxWait` limit. return (lastCallTime === undefined || (timeSinceLastCall >= wait) || (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); } function timerExpired() { var time = now(); if (shouldInvoke(time)) { return trailingEdge(time); } // Restart the timer. timerId = setTimeout(timerExpired, remainingWait(time)); } function trailingEdge(time) { timerId = undefined; // Only invoke if we have `lastArgs` which means `func` has been // debounced at least once. if (trailing && lastArgs) { return invokeFunc(time); } lastArgs = lastThis = undefined; return result; } function cancel() { if (timerId !== undefined) { clearTimeout(timerId); } lastInvokeTime = 0; lastArgs = lastCallTime = lastThis = timerId = undefined; } function flush() { return timerId === undefined ? result : trailingEdge(now()); } function debounced() { var time = now(), isInvoking = shouldInvoke(time); lastArgs = arguments; lastThis = this; lastCallTime = time; if (isInvoking) { if (timerId === undefined) { return leadingEdge(lastCallTime); } if (maxing) { // Handle invocations in a tight loop. clearTimeout(timerId); timerId = setTimeout(timerExpired, wait); return invokeFunc(lastCallTime); } } if (timerId === undefined) { timerId = setTimeout(timerExpired, wait); } return result; } debounced.cancel = cancel; debounced.flush = flush; return debounced; } module.exports = debounce; /***/ }), /***/ 53816: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var deburrLetter = __webpack_require__(69389), toString = __webpack_require__(79833); /** Used to match Latin Unicode letters (excluding mathematical operators). */ var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; /** Used to compose unicode character classes. */ var rsComboMarksRange = '\\u0300-\\u036f', reComboHalfMarksRange = '\\ufe20-\\ufe2f', rsComboSymbolsRange = '\\u20d0-\\u20ff', rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange; /** Used to compose unicode capture groups. */ var rsCombo = '[' + rsComboRange + ']'; /** * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). */ var reComboMark = RegExp(rsCombo, 'g'); /** * Deburrs `string` by converting * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A) * letters to basic Latin letters and removing * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to deburr. * @returns {string} Returns the deburred string. * @example * * _.deburr('déjà vu'); * // => 'deja vu' */ function deburr(string) { string = toString(string); return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ''); } module.exports = deburr; /***/ }), /***/ 98066: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseDelay = __webpack_require__(38845), baseRest = __webpack_require__(5976), toNumber = __webpack_require__(14841); /** * Invokes `func` after `wait` milliseconds. Any additional arguments are * provided to `func` when it's invoked. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to delay. * @param {number} wait The number of milliseconds to delay invocation. * @param {...*} [args] The arguments to invoke `func` with. * @returns {number} Returns the timer id. * @example * * _.delay(function(text) { * console.log(text); * }, 1000, 'later'); * // => Logs 'later' after one second. */ var delay = baseRest(function(func, wait, args) { return baseDelay(func, toNumber(wait) || 0, args); }); module.exports = delay; /***/ }), /***/ 77813: /***/ (function(module) { /** * Performs a * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * var object = { 'a': 1 }; * var other = { 'a': 1 }; * * _.eq(object, object); * // => true * * _.eq(object, other); * // => false * * _.eq('a', 'a'); * // => true * * _.eq('a', Object('a')); * // => false * * _.eq(NaN, NaN); * // => true */ function eq(value, other) { return value === other || (value !== value && other !== other); } module.exports = eq; /***/ }), /***/ 94654: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseFlatten = __webpack_require__(21078), map = __webpack_require__(35161); /** * Creates a flattened array of values by running each element in `collection` * thru `iteratee` and flattening the mapped results. The iteratee is invoked * with three arguments: (value, index|key, collection). * * @static * @memberOf _ * @since 4.0.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Array} Returns the new flattened array. * @example * * function duplicate(n) { * return [n, n]; * } * * _.flatMap([1, 2], duplicate); * // => [1, 1, 2, 2] */ function flatMap(collection, iteratee) { return baseFlatten(map(collection, iteratee), 1); } module.exports = flatMap; /***/ }), /***/ 17204: /***/ (function(module) { /** * The inverse of `_.toPairs`; this method returns an object composed * from key-value `pairs`. * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} pairs The key-value pairs. * @returns {Object} Returns the new object. * @example * * _.fromPairs([['a', 1], ['b', 2]]); * // => { 'a': 1, 'b': 2 } */ function fromPairs(pairs) { var index = -1, length = pairs == null ? 0 : pairs.length, result = {}; while (++index < length) { var pair = pairs[index]; result[pair[0]] = pair[1]; } return result; } module.exports = fromPairs; /***/ }), /***/ 27361: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseGet = __webpack_require__(97786); /** * Gets the value at `path` of `object`. If the resolved value is * `undefined`, the `defaultValue` is returned in its place. * * @static * @memberOf _ * @since 3.7.0 * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path of the property to get. * @param {*} [defaultValue] The value returned for `undefined` resolved values. * @returns {*} Returns the resolved value. * @example * * var object = { 'a': [{ 'b': { 'c': 3 } }] }; * * _.get(object, 'a[0].b.c'); * // => 3 * * _.get(object, ['a', '0', 'b', 'c']); * // => 3 * * _.get(object, 'a.b.c', 'default'); * // => 'default' */ function get(object, path, defaultValue) { var result = object == null ? undefined : baseGet(object, path); return result === undefined ? defaultValue : result; } module.exports = get; /***/ }), /***/ 7739: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseAssignValue = __webpack_require__(89465), createAggregator = __webpack_require__(55189); /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Creates an object composed of keys generated from the results of running * each element of `collection` thru `iteratee`. The order of grouped values * is determined by the order they occur in `collection`. The corresponding * value of each key is an array of elements responsible for generating the * key. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The iteratee to transform keys. * @returns {Object} Returns the composed aggregate object. * @example * * _.groupBy([6.1, 4.2, 6.3], Math.floor); * // => { '4': [4.2], '6': [6.1, 6.3] } * * // The `_.property` iteratee shorthand. * _.groupBy(['one', 'two', 'three'], 'length'); * // => { '3': ['one', 'two'], '5': ['three'] } */ var groupBy = createAggregator(function(result, value, key) { if (hasOwnProperty.call(result, key)) { result[key].push(value); } else { baseAssignValue(result, key, [value]); } }); module.exports = groupBy; /***/ }), /***/ 79095: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseHasIn = __webpack_require__(13), hasPath = __webpack_require__(222); /** * Checks if `path` is a direct or inherited property of `object`. * * @static * @memberOf _ * @since 4.0.0 * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path to check. * @returns {boolean} Returns `true` if `path` exists, else `false`. * @example * * var object = _.create({ 'a': _.create({ 'b': 2 }) }); * * _.hasIn(object, 'a'); * // => true * * _.hasIn(object, 'a.b'); * // => true * * _.hasIn(object, ['a', 'b']); * // => true * * _.hasIn(object, 'b'); * // => false */ function hasIn(object, path) { return object != null && hasPath(object, path, baseHasIn); } module.exports = hasIn; /***/ }), /***/ 6557: /***/ (function(module) { /** * This method returns the first argument it receives. * * @static * @since 0.1.0 * @memberOf _ * @category Util * @param {*} value Any value. * @returns {*} Returns `value`. * @example * * var object = { 'a': 1 }; * * console.log(_.identity(object) === object); * // => true */ function identity(value) { return value; } module.exports = identity; /***/ }), /***/ 1025: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseIsArguments = __webpack_require__(9454), isObjectLike = __webpack_require__(37005); /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** Built-in value references. */ var propertyIsEnumerable = objectProto.propertyIsEnumerable; /** * Checks if `value` is likely an `arguments` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an `arguments` object, * else `false`. * @example * * _.isArguments(function() { return arguments; }()); * // => true * * _.isArguments([1, 2, 3]); * // => false */ var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee'); }; module.exports = isArguments; /***/ }), /***/ 1469: /***/ (function(module) { /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array, else `false`. * @example * * _.isArray([1, 2, 3]); * // => true * * _.isArray(document.body.children); * // => false * * _.isArray('abc'); * // => false * * _.isArray(_.noop); * // => false */ var isArray = Array.isArray; module.exports = isArray; /***/ }), /***/ 98612: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var isFunction = __webpack_require__(23560), isLength = __webpack_require__(41780); /** * Checks if `value` is array-like. A value is considered array-like if it's * not a function and has a `value.length` that's an integer greater than or * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. * @example * * _.isArrayLike([1, 2, 3]); * // => true * * _.isArrayLike(document.body.children); * // => true * * _.isArrayLike('abc'); * // => true * * _.isArrayLike(_.noop); * // => false */ function isArrayLike(value) { return value != null && isLength(value.length) && !isFunction(value); } module.exports = isArrayLike; /***/ }), /***/ 29246: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var isArrayLike = __webpack_require__(98612), isObjectLike = __webpack_require__(37005); /** * This method is like `_.isArrayLike` except that it also checks if `value` * is an object. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array-like object, * else `false`. * @example * * _.isArrayLikeObject([1, 2, 3]); * // => true * * _.isArrayLikeObject(document.body.children); * // => true * * _.isArrayLikeObject('abc'); * // => false * * _.isArrayLikeObject(_.noop); * // => false */ function isArrayLikeObject(value) { return isObjectLike(value) && isArrayLike(value); } module.exports = isArrayLikeObject; /***/ }), /***/ 44144: /***/ (function(module, exports, __webpack_require__) { /* module decorator */ module = __webpack_require__.nmd(module); var root = __webpack_require__(55639), stubFalse = __webpack_require__(95062); /** Detect free variable `exports`. */ var freeExports = true && exports && !exports.nodeType && exports; /** Detect free variable `module`. */ var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module; /** Detect the popular CommonJS extension `module.exports`. */ var moduleExports = freeModule && freeModule.exports === freeExports; /** Built-in value references. */ var Buffer = moduleExports ? root.Buffer : undefined; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined; /** * Checks if `value` is a buffer. * * @static * @memberOf _ * @since 4.3.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. * @example * * _.isBuffer(new Buffer(2)); * // => true * * _.isBuffer(new Uint8Array(2)); * // => false */ var isBuffer = nativeIsBuffer || stubFalse; module.exports = isBuffer; /***/ }), /***/ 41609: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseKeys = __webpack_require__(280), getTag = __webpack_require__(64160), isArguments = __webpack_require__(1025), isArray = __webpack_require__(1469), isArrayLike = __webpack_require__(98612), isBuffer = __webpack_require__(44144), isPrototype = __webpack_require__(25726), isTypedArray = __webpack_require__(36719); /** `Object#toString` result references. */ var mapTag = '[object Map]', setTag = '[object Set]'; /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Checks if `value` is an empty object, collection, map, or set. * * Objects are considered empty if they have no own enumerable string keyed * properties. * * Array-like values such as `arguments` objects, arrays, buffers, strings, or * jQuery-like collections are considered empty if they have a `length` of `0`. * Similarly, maps and sets are considered empty if they have a `size` of `0`. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is empty, else `false`. * @example * * _.isEmpty(null); * // => true * * _.isEmpty(true); * // => true * * _.isEmpty(1); * // => true * * _.isEmpty([1, 2, 3]); * // => false * * _.isEmpty({ 'a': 1 }); * // => false */ function isEmpty(value) { if (value == null) { return true; } if (isArrayLike(value) && (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || isBuffer(value) || isTypedArray(value) || isArguments(value))) { return !value.length; } var tag = getTag(value); if (tag == mapTag || tag == setTag) { return !value.size; } if (isPrototype(value)) { return !baseKeys(value).length; } for (var key in value) { if (hasOwnProperty.call(value, key)) { return false; } } return true; } module.exports = isEmpty; /***/ }), /***/ 23560: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseGetTag = __webpack_require__(44239), isObject = __webpack_require__(13218); /** `Object#toString` result references. */ var asyncTag = '[object AsyncFunction]', funcTag = '[object Function]', genTag = '[object GeneratorFunction]', proxyTag = '[object Proxy]'; /** * Checks if `value` is classified as a `Function` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); * // => true * * _.isFunction(/abc/); * // => false */ function isFunction(value) { if (!isObject(value)) { return false; } // The use of `Object#toString` avoids issues with the `typeof` operator // in Safari 9 which returns 'object' for typed arrays and other constructors. var tag = baseGetTag(value); return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; } module.exports = isFunction; /***/ }), /***/ 41780: /***/ (function(module) { /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; /** * Checks if `value` is a valid array-like length. * * **Note:** This method is loosely based on * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); * // => true * * _.isLength(Number.MIN_VALUE); * // => false * * _.isLength(Infinity); * // => false * * _.isLength('3'); * // => false */ function isLength(value) { return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } module.exports = isLength; /***/ }), /***/ 13218: /***/ (function(module) { /** * Checks if `value` is the * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(_.noop); * // => true * * _.isObject(null); * // => false */ function isObject(value) { var type = typeof value; return value != null && (type == 'object' || type == 'function'); } module.exports = isObject; /***/ }), /***/ 37005: /***/ (function(module) { /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * * _.isObjectLike({}); * // => true * * _.isObjectLike([1, 2, 3]); * // => true * * _.isObjectLike(_.noop); * // => false * * _.isObjectLike(null); * // => false */ function isObjectLike(value) { return value != null && typeof value == 'object'; } module.exports = isObjectLike; /***/ }), /***/ 68630: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseGetTag = __webpack_require__(44239), getPrototype = __webpack_require__(85924), isObjectLike = __webpack_require__(37005); /** `Object#toString` result references. */ var objectTag = '[object Object]'; /** Used for built-in method references. */ var funcProto = Function.prototype, objectProto = Object.prototype; /** Used to resolve the decompiled source of functions. */ var funcToString = funcProto.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** Used to infer the `Object` constructor. */ var objectCtorString = funcToString.call(Object); /** * Checks if `value` is a plain object, that is, an object created by the * `Object` constructor or one with a `[[Prototype]]` of `null`. * * @static * @memberOf _ * @since 0.8.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. * @example * * function Foo() { * this.a = 1; * } * * _.isPlainObject(new Foo); * // => false * * _.isPlainObject([1, 2, 3]); * // => false * * _.isPlainObject({ 'x': 0, 'y': 0 }); * // => true * * _.isPlainObject(Object.create(null)); * // => true */ function isPlainObject(value) { if (!isObjectLike(value) || baseGetTag(value) != objectTag) { return false; } var proto = getPrototype(value); if (proto === null) { return true; } var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; return typeof Ctor == 'function' && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString; } module.exports = isPlainObject; /***/ }), /***/ 33448: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseGetTag = __webpack_require__(44239), isObjectLike = __webpack_require__(37005); /** `Object#toString` result references. */ var symbolTag = '[object Symbol]'; /** * Checks if `value` is classified as a `Symbol` primitive or object. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. * @example * * _.isSymbol(Symbol.iterator); * // => true * * _.isSymbol('abc'); * // => false */ function isSymbol(value) { return typeof value == 'symbol' || (isObjectLike(value) && baseGetTag(value) == symbolTag); } module.exports = isSymbol; /***/ }), /***/ 36719: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseIsTypedArray = __webpack_require__(38749), baseUnary = __webpack_require__(7518), nodeUtil = __webpack_require__(31167); /* Node.js helper references. */ var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; /** * Checks if `value` is classified as a typed array. * * @static * @memberOf _ * @since 3.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. * @example * * _.isTypedArray(new Uint8Array); * // => true * * _.isTypedArray([]); * // => false */ var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; module.exports = isTypedArray; /***/ }), /***/ 21804: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var createCompounder = __webpack_require__(35393); /** * Converts `string` to * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the kebab cased string. * @example * * _.kebabCase('Foo Bar'); * // => 'foo-bar' * * _.kebabCase('fooBar'); * // => 'foo-bar' * * _.kebabCase('__FOO_BAR__'); * // => 'foo-bar' */ var kebabCase = createCompounder(function(result, word, index) { return result + (index ? '-' : '') + word.toLowerCase(); }); module.exports = kebabCase; /***/ }), /***/ 24350: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseAssignValue = __webpack_require__(89465), createAggregator = __webpack_require__(55189); /** * Creates an object composed of keys generated from the results of running * each element of `collection` thru `iteratee`. The corresponding value of * each key is the last element responsible for generating the key. The * iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @since 4.0.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The iteratee to transform keys. * @returns {Object} Returns the composed aggregate object. * @example * * var array = [ * { 'dir': 'left', 'code': 97 }, * { 'dir': 'right', 'code': 100 } * ]; * * _.keyBy(array, function(o) { * return String.fromCharCode(o.code); * }); * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } * * _.keyBy(array, 'dir'); * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } */ var keyBy = createAggregator(function(result, value, key) { baseAssignValue(result, key, value); }); module.exports = keyBy; /***/ }), /***/ 3674: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var arrayLikeKeys = __webpack_require__(14636), baseKeys = __webpack_require__(280), isArrayLike = __webpack_require__(98612); /** * Creates an array of the own enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. See the * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) * for more details. * * @static * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.keys(new Foo); * // => ['a', 'b'] (iteration order is not guaranteed) * * _.keys('hi'); * // => ['0', '1'] */ function keys(object) { return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); } module.exports = keys; /***/ }), /***/ 81704: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var arrayLikeKeys = __webpack_require__(14636), baseKeysIn = __webpack_require__(10313), isArrayLike = __webpack_require__(98612); /** * Creates an array of the own and inherited enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. * * @static * @memberOf _ * @since 3.0.0 * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.keysIn(new Foo); * // => ['a', 'b', 'c'] (iteration order is not guaranteed) */ function keysIn(object) { return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); } module.exports = keysIn; /***/ }), /***/ 35161: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var arrayMap = __webpack_require__(29932), baseIteratee = __webpack_require__(67206), baseMap = __webpack_require__(69199), isArray = __webpack_require__(1469); /** * Creates an array of values by running each element in `collection` thru * `iteratee`. The iteratee is invoked with three arguments: * (value, index|key, collection). * * Many lodash methods are guarded to work as iteratees for methods like * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. * * The guarded methods are: * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`, * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`, * `template`, `trim`, `trimEnd`, `trimStart`, and `words` * * @static * @memberOf _ * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Array} Returns the new mapped array. * @example * * function square(n) { * return n * n; * } * * _.map([4, 8], square); * // => [16, 64] * * _.map({ 'a': 4, 'b': 8 }, square); * // => [16, 64] (iteration order is not guaranteed) * * var users = [ * { 'user': 'barney' }, * { 'user': 'fred' } * ]; * * // The `_.property` iteratee shorthand. * _.map(users, 'user'); * // => ['barney', 'fred'] */ function map(collection, iteratee) { var func = isArray(collection) ? arrayMap : baseMap; return func(collection, baseIteratee(iteratee, 3)); } module.exports = map; /***/ }), /***/ 66604: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseAssignValue = __webpack_require__(89465), baseForOwn = __webpack_require__(47816), baseIteratee = __webpack_require__(67206); /** * Creates an object with the same keys as `object` and values generated * by running each own enumerable string keyed property of `object` thru * `iteratee`. The iteratee is invoked with three arguments: * (value, key, object). * * @static * @memberOf _ * @since 2.4.0 * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Object} Returns the new mapped object. * @see _.mapKeys * @example * * var users = { * 'fred': { 'user': 'fred', 'age': 40 }, * 'pebbles': { 'user': 'pebbles', 'age': 1 } * }; * * _.mapValues(users, function(o) { return o.age; }); * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) * * // The `_.property` iteratee shorthand. * _.mapValues(users, 'age'); * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) */ function mapValues(object, iteratee) { var result = {}; iteratee = baseIteratee(iteratee, 3); baseForOwn(object, function(value, key, object) { baseAssignValue(result, key, iteratee(value, key, object)); }); return result; } module.exports = mapValues; /***/ }), /***/ 88306: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var MapCache = __webpack_require__(83369); /** Error message constants. */ var FUNC_ERROR_TEXT = 'Expected a function'; /** * Creates a function that memoizes the result of `func`. If `resolver` is * provided, it determines the cache key for storing the result based on the * arguments provided to the memoized function. By default, the first argument * provided to the memoized function is used as the map cache key. The `func` * is invoked with the `this` binding of the memoized function. * * **Note:** The cache is exposed as the `cache` property on the memoized * function. Its creation may be customized by replacing the `_.memoize.Cache` * constructor with one whose instances implement the * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) * method interface of `clear`, `delete`, `get`, `has`, and `set`. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to have its output memoized. * @param {Function} [resolver] The function to resolve the cache key. * @returns {Function} Returns the new memoized function. * @example * * var object = { 'a': 1, 'b': 2 }; * var other = { 'c': 3, 'd': 4 }; * * var values = _.memoize(_.values); * values(object); * // => [1, 2] * * values(other); * // => [3, 4] * * object.a = 2; * values(object); * // => [1, 2] * * // Modify the result cache. * values.cache.set(object, ['a', 'b']); * values(object); * // => ['a', 'b'] * * // Replace `_.memoize.Cache`. * _.memoize.Cache = WeakMap; */ function memoize(func, resolver) { if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) { throw new TypeError(FUNC_ERROR_TEXT); } var memoized = function() { var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache; if (cache.has(key)) { return cache.get(key); } var result = func.apply(this, args); memoized.cache = cache.set(key, result) || cache; return result; }; memoized.cache = new (memoize.Cache || MapCache); return memoized; } // Expose `MapCache`. memoize.Cache = MapCache; module.exports = memoize; /***/ }), /***/ 82492: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseMerge = __webpack_require__(42980), createAssigner = __webpack_require__(21463); /** * This method is like `_.assign` except that it recursively merges own and * inherited enumerable string keyed properties of source objects into the * destination object. Source properties that resolve to `undefined` are * skipped if a destination value exists. Array and plain object properties * are merged recursively. Other objects and value types are overridden by * assignment. Source objects are applied from left to right. Subsequent * sources overwrite property assignments of previous sources. * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @since 0.5.0 * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. * @returns {Object} Returns `object`. * @example * * var object = { * 'a': [{ 'b': 2 }, { 'd': 4 }] * }; * * var other = { * 'a': [{ 'c': 3 }, { 'e': 5 }] * }; * * _.merge(object, other); * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] } */ var merge = createAssigner(function(object, source, srcIndex) { baseMerge(object, source, srcIndex); }); module.exports = merge; /***/ }), /***/ 94885: /***/ (function(module) { /** Error message constants. */ var FUNC_ERROR_TEXT = 'Expected a function'; /** * Creates a function that negates the result of the predicate `func`. The * `func` predicate is invoked with the `this` binding and arguments of the * created function. * * @static * @memberOf _ * @since 3.0.0 * @category Function * @param {Function} predicate The predicate to negate. * @returns {Function} Returns the new negated function. * @example * * function isEven(n) { * return n % 2 == 0; * } * * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)); * // => [1, 3, 5] */ function negate(predicate) { if (typeof predicate != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } return function() { var args = arguments; switch (args.length) { case 0: return !predicate.call(this); case 1: return !predicate.call(this, args[0]); case 2: return !predicate.call(this, args[0], args[1]); case 3: return !predicate.call(this, args[0], args[1], args[2]); } return !predicate.apply(this, args); }; } module.exports = negate; /***/ }), /***/ 50308: /***/ (function(module) { /** * This method returns `undefined`. * * @static * @memberOf _ * @since 2.3.0 * @category Util * @example * * _.times(2, _.noop); * // => [undefined, undefined] */ function noop() { // No operation performed. } module.exports = noop; /***/ }), /***/ 7771: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var root = __webpack_require__(55639); /** * Gets the timestamp of the number of milliseconds that have elapsed since * the Unix epoch (1 January 1970 00:00:00 UTC). * * @static * @memberOf _ * @since 2.4.0 * @category Date * @returns {number} Returns the timestamp. * @example * * _.defer(function(stamp) { * console.log(_.now() - stamp); * }, _.now()); * // => Logs the number of milliseconds it took for the deferred invocation. */ var now = function() { return root.Date.now(); }; module.exports = now; /***/ }), /***/ 14176: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseIteratee = __webpack_require__(67206), negate = __webpack_require__(94885), pickBy = __webpack_require__(35937); /** * The opposite of `_.pickBy`; this method creates an object composed of * the own and inherited enumerable string keyed properties of `object` that * `predicate` doesn't return truthy for. The predicate is invoked with two * arguments: (value, key). * * @static * @memberOf _ * @since 4.0.0 * @category Object * @param {Object} object The source object. * @param {Function} [predicate=_.identity] The function invoked per property. * @returns {Object} Returns the new object. * @example * * var object = { 'a': 1, 'b': '2', 'c': 3 }; * * _.omitBy(object, _.isNumber); * // => { 'b': '2' } */ function omitBy(object, predicate) { return pickBy(object, negate(baseIteratee(predicate))); } module.exports = omitBy; /***/ }), /***/ 75472: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseOrderBy = __webpack_require__(82689), isArray = __webpack_require__(1469); /** * This method is like `_.sortBy` except that it allows specifying the sort * orders of the iteratees to sort by. If `orders` is unspecified, all values * are sorted in ascending order. Otherwise, specify an order of "desc" for * descending or "asc" for ascending sort order of corresponding values. * * @static * @memberOf _ * @since 4.0.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]] * The iteratees to sort by. * @param {string[]} [orders] The sort orders of `iteratees`. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. * @returns {Array} Returns the new sorted array. * @example * * var users = [ * { 'user': 'fred', 'age': 48 }, * { 'user': 'barney', 'age': 34 }, * { 'user': 'fred', 'age': 40 }, * { 'user': 'barney', 'age': 36 } * ]; * * // Sort by `user` in ascending order and by `age` in descending order. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] */ function orderBy(collection, iteratees, orders, guard) { if (collection == null) { return []; } if (!isArray(iteratees)) { iteratees = iteratees == null ? [] : [iteratees]; } orders = guard ? undefined : orders; if (!isArray(orders)) { orders = orders == null ? [] : [orders]; } return baseOrderBy(collection, iteratees, orders); } module.exports = orderBy; /***/ }), /***/ 35937: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var arrayMap = __webpack_require__(29932), baseIteratee = __webpack_require__(67206), basePickBy = __webpack_require__(63012), getAllKeysIn = __webpack_require__(46904); /** * Creates an object composed of the `object` properties `predicate` returns * truthy for. The predicate is invoked with two arguments: (value, key). * * @static * @memberOf _ * @since 4.0.0 * @category Object * @param {Object} object The source object. * @param {Function} [predicate=_.identity] The function invoked per property. * @returns {Object} Returns the new object. * @example * * var object = { 'a': 1, 'b': '2', 'c': 3 }; * * _.pickBy(object, _.isNumber); * // => { 'a': 1, 'c': 3 } */ function pickBy(object, predicate) { if (object == null) { return {}; } var props = arrayMap(getAllKeysIn(object), function(prop) { return [prop]; }); predicate = baseIteratee(predicate); return basePickBy(object, props, function(value, path) { return predicate(value, path[0]); }); } module.exports = pickBy; /***/ }), /***/ 39601: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseProperty = __webpack_require__(40371), basePropertyDeep = __webpack_require__(79152), isKey = __webpack_require__(15403), toKey = __webpack_require__(40327); /** * Creates a function that returns the value at `path` of a given object. * * @static * @memberOf _ * @since 2.4.0 * @category Util * @param {Array|string} path The path of the property to get. * @returns {Function} Returns the new accessor function. * @example * * var objects = [ * { 'a': { 'b': 2 } }, * { 'a': { 'b': 1 } } * ]; * * _.map(objects, _.property('a.b')); * // => [2, 1] * * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b'); * // => [1, 2] */ function property(path) { return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); } module.exports = property; /***/ }), /***/ 96026: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var createRange = __webpack_require__(47445); /** * Creates an array of numbers (positive and/or negative) progressing from * `start` up to, but not including, `end`. A step of `-1` is used if a negative * `start` is specified without an `end` or `step`. If `end` is not specified, * it's set to `start` with `start` then set to `0`. * * **Note:** JavaScript follows the IEEE-754 standard for resolving * floating-point values which can produce unexpected results. * * @static * @since 0.1.0 * @memberOf _ * @category Util * @param {number} [start=0] The start of the range. * @param {number} end The end of the range. * @param {number} [step=1] The value to increment or decrement by. * @returns {Array} Returns the range of numbers. * @see _.inRange, _.rangeRight * @example * * _.range(4); * // => [0, 1, 2, 3] * * _.range(-4); * // => [0, -1, -2, -3] * * _.range(1, 5); * // => [1, 2, 3, 4] * * _.range(0, 20, 5); * // => [0, 5, 10, 15] * * _.range(0, -4, -1); * // => [0, -1, -2, -3] * * _.range(1, 4, 0); * // => [1, 1, 1] * * _.range(0); * // => [] */ var range = createRange(); module.exports = range; /***/ }), /***/ 70479: /***/ (function(module) { /** * This method returns a new empty array. * * @static * @memberOf _ * @since 4.13.0 * @category Util * @returns {Array} Returns the new empty array. * @example * * var arrays = _.times(2, _.stubArray); * * console.log(arrays); * // => [[], []] * * console.log(arrays[0] === arrays[1]); * // => false */ function stubArray() { return []; } module.exports = stubArray; /***/ }), /***/ 95062: /***/ (function(module) { /** * This method returns `false`. * * @static * @memberOf _ * @since 4.13.0 * @category Util * @returns {boolean} Returns `false`. * @example * * _.times(2, _.stubFalse); * // => [false, false] */ function stubFalse() { return false; } module.exports = stubFalse; /***/ }), /***/ 23493: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var debounce = __webpack_require__(23279), isObject = __webpack_require__(13218); /** Error message constants. */ var FUNC_ERROR_TEXT = 'Expected a function'; /** * Creates a throttled function that only invokes `func` at most once per * every `wait` milliseconds. The throttled function comes with a `cancel` * method to cancel delayed `func` invocations and a `flush` method to * immediately invoke them. Provide `options` to indicate whether `func` * should be invoked on the leading and/or trailing edge of the `wait` * timeout. The `func` is invoked with the last arguments provided to the * throttled function. Subsequent calls to the throttled function return the * result of the last `func` invocation. * * **Note:** If `leading` and `trailing` options are `true`, `func` is * invoked on the trailing edge of the timeout only if the throttled function * is invoked more than once during the `wait` timeout. * * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred * until to the next tick, similar to `setTimeout` with a timeout of `0`. * * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) * for details over the differences between `_.throttle` and `_.debounce`. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to throttle. * @param {number} [wait=0] The number of milliseconds to throttle invocations to. * @param {Object} [options={}] The options object. * @param {boolean} [options.leading=true] * Specify invoking on the leading edge of the timeout. * @param {boolean} [options.trailing=true] * Specify invoking on the trailing edge of the timeout. * @returns {Function} Returns the new throttled function. * @example * * // Avoid excessively updating the position while scrolling. * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); * * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false }); * jQuery(element).on('click', throttled); * * // Cancel the trailing throttled invocation. * jQuery(window).on('popstate', throttled.cancel); */ function throttle(func, wait, options) { var leading = true, trailing = true; if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } if (isObject(options)) { leading = 'leading' in options ? !!options.leading : leading; trailing = 'trailing' in options ? !!options.trailing : trailing; } return debounce(func, wait, { 'leading': leading, 'maxWait': wait, 'trailing': trailing }); } module.exports = throttle; /***/ }), /***/ 18601: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var toNumber = __webpack_require__(14841); /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0, MAX_INTEGER = 1.7976931348623157e+308; /** * Converts `value` to a finite number. * * @static * @memberOf _ * @since 4.12.0 * @category Lang * @param {*} value The value to convert. * @returns {number} Returns the converted number. * @example * * _.toFinite(3.2); * // => 3.2 * * _.toFinite(Number.MIN_VALUE); * // => 5e-324 * * _.toFinite(Infinity); * // => 1.7976931348623157e+308 * * _.toFinite('3.2'); * // => 3.2 */ function toFinite(value) { if (!value) { return value === 0 ? value : 0; } value = toNumber(value); if (value === INFINITY || value === -INFINITY) { var sign = (value < 0 ? -1 : 1); return sign * MAX_INTEGER; } return value === value ? value : 0; } module.exports = toFinite; /***/ }), /***/ 40554: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var toFinite = __webpack_require__(18601); /** * Converts `value` to an integer. * * **Note:** This method is loosely based on * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to convert. * @returns {number} Returns the converted integer. * @example * * _.toInteger(3.2); * // => 3 * * _.toInteger(Number.MIN_VALUE); * // => 0 * * _.toInteger(Infinity); * // => 1.7976931348623157e+308 * * _.toInteger('3.2'); * // => 3 */ function toInteger(value) { var result = toFinite(value), remainder = result % 1; return result === result ? (remainder ? result - remainder : result) : 0; } module.exports = toInteger; /***/ }), /***/ 14841: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseTrim = __webpack_require__(27561), isObject = __webpack_require__(13218), isSymbol = __webpack_require__(33448); /** Used as references for various `Number` constants. */ var NAN = 0 / 0; /** Used to detect bad signed hexadecimal string values. */ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; /** Used to detect binary string values. */ var reIsBinary = /^0b[01]+$/i; /** Used to detect octal string values. */ var reIsOctal = /^0o[0-7]+$/i; /** Built-in method references without a dependency on `root`. */ var freeParseInt = parseInt; /** * Converts `value` to a number. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to process. * @returns {number} Returns the number. * @example * * _.toNumber(3.2); * // => 3.2 * * _.toNumber(Number.MIN_VALUE); * // => 5e-324 * * _.toNumber(Infinity); * // => Infinity * * _.toNumber('3.2'); * // => 3.2 */ function toNumber(value) { if (typeof value == 'number') { return value; } if (isSymbol(value)) { return NAN; } if (isObject(value)) { var other = typeof value.valueOf == 'function' ? value.valueOf() : value; value = isObject(other) ? (other + '') : other; } if (typeof value != 'string') { return value === 0 ? value : +value; } value = baseTrim(value); var isBinary = reIsBinary.test(value); return (isBinary || reIsOctal.test(value)) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : (reIsBadHex.test(value) ? NAN : +value); } module.exports = toNumber; /***/ }), /***/ 59881: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var copyObject = __webpack_require__(98363), keysIn = __webpack_require__(81704); /** * Converts `value` to a plain object flattening inherited enumerable string * keyed properties of `value` to own properties of the plain object. * * @static * @memberOf _ * @since 3.0.0 * @category Lang * @param {*} value The value to convert. * @returns {Object} Returns the converted plain object. * @example * * function Foo() { * this.b = 2; * } * * Foo.prototype.c = 3; * * _.assign({ 'a': 1 }, new Foo); * // => { 'a': 1, 'b': 2 } * * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); * // => { 'a': 1, 'b': 2, 'c': 3 } */ function toPlainObject(value) { return copyObject(value, keysIn(value)); } module.exports = toPlainObject; /***/ }), /***/ 79833: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseToString = __webpack_require__(80531); /** * Converts `value` to a string. An empty string is returned for `null` * and `undefined` values. The sign of `-0` is preserved. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to convert. * @returns {string} Returns the converted string. * @example * * _.toString(null); * // => '' * * _.toString(-0); * // => '-0' * * _.toString([1, 2, 3]); * // => '1,2,3' */ function toString(value) { return value == null ? '' : baseToString(value); } module.exports = toString; /***/ }), /***/ 44908: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseUniq = __webpack_require__(45652); /** * Creates a duplicate-free version of an array, using * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons, in which only the first occurrence of each element * is kept. The order of result values is determined by the order they occur * in the array. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {Array} array The array to inspect. * @returns {Array} Returns the new duplicate free array. * @example * * _.uniq([2, 1, 2]); * // => [2, 1] */ function uniq(array) { return (array && array.length) ? baseUniq(array) : []; } module.exports = uniq; /***/ }), /***/ 45578: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseIteratee = __webpack_require__(67206), baseUniq = __webpack_require__(45652); /** * This method is like `_.uniq` except that it accepts `iteratee` which is * invoked for each element in `array` to generate the criterion by which * uniqueness is computed. The order of result values is determined by the * order they occur in the array. The iteratee is invoked with one argument: * (value). * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} array The array to inspect. * @param {Function} [iteratee=_.identity] The iteratee invoked per element. * @returns {Array} Returns the new duplicate free array. * @example * * _.uniqBy([2.1, 1.2, 2.3], Math.floor); * // => [2.1, 1.2] * * // The `_.property` iteratee shorthand. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); * // => [{ 'x': 1 }, { 'x': 2 }] */ function uniqBy(array, iteratee) { return (array && array.length) ? baseUniq(array, baseIteratee(iteratee, 2)) : []; } module.exports = uniqBy; /***/ }), /***/ 58748: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var asciiWords = __webpack_require__(49029), hasUnicodeWord = __webpack_require__(93157), toString = __webpack_require__(79833), unicodeWords = __webpack_require__(2757); /** * Splits `string` into an array of its words. * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to inspect. * @param {RegExp|string} [pattern] The pattern to match words. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Array} Returns the words of `string`. * @example * * _.words('fred, barney, & pebbles'); * // => ['fred', 'barney', 'pebbles'] * * _.words('fred, barney, & pebbles', /[^, ]+/g); * // => ['fred', 'barney', '&', 'pebbles'] */ function words(string, pattern, guard) { string = toString(string); pattern = guard ? undefined : pattern; if (pattern === undefined) { return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string); } return string.match(pattern) || []; } module.exports = words; /***/ }), /***/ 79746: /***/ (function(module) { module.exports = assert; function assert(val, msg) { if (!val) throw new Error(msg || 'Assertion failed'); } assert.equal = function assertEqual(l, r, msg) { if (l != r) throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r)); }; /***/ }), /***/ 82010: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "F": function() { return /* binding */ h; }, /* harmony export */ "f": function() { return /* binding */ y; } /* harmony export */ }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(67294); const m=["light","dark"],i="(prefers-color-scheme: dark)",c="undefined"==typeof window,d=/*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(void 0),u={setTheme:e=>{},themes:[]},h=()=>{var e;return null!==(e=(0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(d))&&void 0!==e?e:u},y=r=>(0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(d)?/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment,null,r.children):/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement($,r),$=({forcedTheme:t,disableTransitionOnChange:n=!1,enableSystem:s=!0,enableColorScheme:l=!0,storageKey:c="theme",themes:u=["light","dark"],defaultTheme:h=(s?"system":"light"),attribute:y="data-theme",value:$,children:b,nonce:p})=>{const[w,T]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(()=>f(c,h)),[E,k]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(()=>f(c)),C=$?Object.values($):u,L=(0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(e=>{let t=e;if(!t)return;"system"===e&&s&&(t=S());const r=$?$[t]:t,o=n?g():null,a=document.documentElement;if("class"===y?(a.classList.remove(...C),r&&a.classList.add(r)):r?a.setAttribute(y,r):a.removeAttribute(y),l){const e=m.includes(h)?h:null,n=m.includes(t)?t:e;a.style.colorScheme=n}null==o||o()},[]),x=(0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(e=>{T(e);try{localStorage.setItem(c,e)}catch(e){}},[t]),I=(0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(e=>{const n=S(e);k(n),"system"===w&&s&&!t&&L("system")},[w,t]);return (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(()=>{const e=window.matchMedia(i);return e.addListener(I),I(e),()=>e.removeListener(I)},[I]),(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(()=>{const e=e=>{e.key===c&&x(e.newValue||h)};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[x]),(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(()=>{L(null!=t?t:w)},[t,w]),/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(d.Provider,{value:{theme:w,setTheme:x,forcedTheme:t,resolvedTheme:"system"===w?E:w,themes:s?[...u,"system"]:u,systemTheme:s?E:void 0}},/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(v,{forcedTheme:t,disableTransitionOnChange:n,enableSystem:s,enableColorScheme:l,storageKey:c,themes:u,defaultTheme:h,attribute:y,value:$,children:b,attrs:C,nonce:p}),b)},v=/*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.memo)(({forcedTheme:t,storageKey:n,attribute:r,enableSystem:o,enableColorScheme:a,defaultTheme:s,value:l,attrs:c,nonce:d})=>{const u="system"===s,h="class"===r?`var d=document.documentElement,c=d.classList;c.remove(${c.map(e=>`'${e}'`).join(",")});`:`var d=document.documentElement,n='${r}',s='setAttribute';`,y=a?m.includes(s)&&s?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${s}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",$=(e,t=!1,n=!0)=>{const o=l?l[e]:e,s=t?e+"|| ''":`'${o}'`;let i="";return a&&n&&!t&&m.includes(e)&&(i+=`d.style.colorScheme = '${e}';`),"class"===r?i+=t||o?`c.add(${s})`:"null":o&&(i+=`d[s](n,${s})`),i},v=t?`!function(){${h}${$(t)}}()`:o?`!function(){try{${h}var e=localStorage.getItem('${n}');if('system'===e||(!e&&${u})){var t='${i}',m=window.matchMedia(t);if(m.media!==t||m.matches){${$("dark")}}else{${$("light")}}}else if(e){${l?`var x=${JSON.stringify(l)};`:""}${$(l?"x[e]":"e",!0)}}${u?"":"else{"+$(s,!1,!1)+"}"}${y}}catch(e){}}()`:`!function(){try{${h}var e=localStorage.getItem('${n}');if(e){${l?`var x=${JSON.stringify(l)};`:""}${$(l?"x[e]":"e",!0)}}else{${$(s,!1,!1)};}${y}}catch(t){}}();`;/*#__PURE__*/return react__WEBPACK_IMPORTED_MODULE_0__.createElement("script",{nonce:d,dangerouslySetInnerHTML:{__html:v}})},()=>!0),f=(e,t)=>{if(c)return;let n;try{n=localStorage.getItem(e)||void 0}catch(e){}return n||t},g=()=>{const e=document.createElement("style");return e.appendChild(document.createTextNode("*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(e),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(e)},1)}},S=e=>(e||(e=window.matchMedia(i)),e.matches?"dark":"light"); /***/ }), /***/ 96086: /***/ (function(module) { "use strict"; var assign = Object.assign.bind(Object); module.exports = assign; module.exports["default"] = module.exports; //# sourceMappingURL=object-assign.js.map /***/ }), /***/ 6840: /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { (window.__NEXT_P = window.__NEXT_P || []).push([ "/_app", function () { return __webpack_require__(18279); } ]); if(false) {} /***/ }), /***/ 86338: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { "a_": function() { return /* reexport */ ChainId; }, "ih": function() { return /* reexport */ CurrencyAmount; }, "QA": function() { return /* reexport */ (jsbi_umd_default()); }, "B5": function() { return /* reexport */ NATIVE; }, "_r": function() { return /* reexport */ Native; }, "sO": function() { return /* reexport */ Pair; }, "gG": function() { return /* reexport */ Percent; }, "tA": function() { return /* reexport */ Price; }, "F0": function() { return /* reexport */ Router; }, "WU": function() { return /* reexport */ Token; }, "ho": function() { return /* reexport */ Trade; }, "YL": function() { return /* reexport */ TradeType; }, "$v": function() { return /* reexport */ WBNB; }, "Fb": function() { return /* reexport */ WCRO; }, "g9": function() { return /* reexport */ WETH9; }, "FX": function() { return /* reexport */ WNATIVE; } }); // UNUSED EXPORTS: BaseCurrency, FACTORY_ADDRESS, FACTORY_ADDRESS_BSC, FACTORY_ADDRESS_MAP, FIVE, Fraction, INIT_CODE_HASH, INIT_CODE_HASH_MAP, InsufficientInputAmountError, InsufficientReservesError, MINIMUM_LIQUIDITY, MaxUint256, NativeCurrency, ONE, Rounding, Route, SOLIDITY_TYPE_MAXIMA, SolidityType, TEN, THREE, TWO, ZERO, _100, _10000, _9975, computePairAddress, computePriceImpact, inputOutputComparator, tradeComparator // EXTERNAL MODULE: ./node_modules/jsbi/dist/jsbi-umd.js var jsbi_umd = __webpack_require__(39499); var jsbi_umd_default = /*#__PURE__*/__webpack_require__.n(jsbi_umd); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_define_property.mjs var _define_property = __webpack_require__(14924); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_class_call_check.mjs var _class_call_check = __webpack_require__(51438); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_create_class.mjs var _create_class = __webpack_require__(52951); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_inherits.mjs var _inherits = __webpack_require__(28668); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_create_super.mjs + 2 modules var _create_super = __webpack_require__(25171); ;// CONCATENATED MODULE: ./node_modules/tiny-invariant/dist/tiny-invariant.esm.js var isProduction = "production" === 'production'; var prefix = 'Invariant failed'; function invariant(condition, message) { if (condition) { return; } if (isProduction) { throw new Error(prefix); } var provided = typeof message === 'function' ? message() : message; var value = provided ? prefix + ": " + provided : prefix; throw new Error(value); } // EXTERNAL MODULE: ./node_modules/tiny-warning/dist/tiny-warning.esm.js var tiny_warning_esm = __webpack_require__(45298); // EXTERNAL MODULE: ./node_modules/@ethersproject/address/lib.esm/index.js + 1 modules var lib_esm = __webpack_require__(19485); ;// CONCATENATED MODULE: ./packages/swap-sdk/src/utils.ts function validateSolidityTypeInstance(value, solidityType) { invariant(jsbi_umd_default().greaterThanOrEqual(value, ZERO), "".concat(value, " is not a ").concat(solidityType, ".")); invariant(jsbi_umd_default().lessThanOrEqual(value, SOLIDITY_TYPE_MAXIMA[solidityType]), "".concat(value, " is not a ").concat(solidityType, ".")); } // warns if addresses are not checksummed function validateAndParseAddress(address) { try { var checksummedAddress = (0,lib_esm.getAddress)(address); (0,tiny_warning_esm/* default */.Z)(address === checksummedAddress, "".concat(address, " is not checksummed.")); return checksummedAddress; } catch (error) { invariant(false, "".concat(address, " is not a valid address.")); } } function parseBigintIsh(bigintIsh) { return _instanceof(bigintIsh, JSBI) ? bigintIsh : JSBI.BigInt(bigintIsh); } // mock the on-chain sqrt function function sqrt(y) { validateSolidityTypeInstance(y, SolidityType.uint256); var z = ZERO; var x; if (jsbi_umd_default().greaterThan(y, THREE)) { z = y; x = jsbi_umd_default().add(jsbi_umd_default().divide(y, TWO), ONE); while(jsbi_umd_default().lessThan(x, z)){ z = x; x = jsbi_umd_default().divide(jsbi_umd_default().add(jsbi_umd_default().divide(y, x), x), TWO); } } else if (jsbi_umd_default().notEqual(y, ZERO)) { z = ONE; } return z; } // given an array of items sorted by `comparator`, insert an item into its sort index and constrain the size to // `maxSize` by removing the last item function sortedInsert(items, add, maxSize, comparator) { invariant(maxSize > 0, "MAX_SIZE_ZERO"); // this is an invariant because the interface cannot return multiple removed items if items.length exceeds maxSize invariant(items.length <= maxSize, "ITEMS_SIZE"); // short circuit first item add if (items.length === 0) { items.push(add); return null; } else { var isFull = items.length === maxSize; // short circuit if full and the additional item does not come before the last item if (isFull && comparator(items[items.length - 1], add) <= 0) { return add; } var lo = 0, hi = items.length; while(lo < hi){ var mid = lo + hi >>> 1; if (comparator(items[mid], add) <= 0) { lo = mid + 1; } else { hi = mid; } } items.splice(lo, 0, add); return isFull ? items.pop() : null; } } /** * Returns the percent difference between the mid price and the execution price, i.e. price impact. * @param midPrice mid price before the trade * @param inputAmount the input amount of the trade * @param outputAmount the output amount of the trade */ function computePriceImpact(midPrice, inputAmount, outputAmount) { var quotedOutputAmount = midPrice.quote(inputAmount); // calculate price impact := (exactQuote - outputAmount) / exactQuote var priceImpact = quotedOutputAmount.subtract(outputAmount).divide(quotedOutputAmount); return new Percent(priceImpact.numerator, priceImpact.denominator); } ;// CONCATENATED MODULE: ./packages/swap-sdk/src/entities/baseCurrency.ts /** * A currency is any fungible financial instrument, including Ether, all ERC20 tokens, and other chain-native currencies */ var BaseCurrency = function BaseCurrency(chainId, decimals, symbol, name) { "use strict"; (0,_class_call_check/* default */.Z)(this, BaseCurrency); invariant(Number.isSafeInteger(chainId), "CHAIN_ID"); invariant(decimals >= 0 && decimals < 255 && Number.isInteger(decimals), "DECIMALS"); this.chainId = chainId; this.decimals = decimals; this.symbol = symbol; this.name = name; }; ;// CONCATENATED MODULE: ./packages/swap-sdk/src/entities/token.ts /** * Represents an ERC20 token with a unique address and some metadata. */ var Token = /*#__PURE__*/ function(BaseCurrency) { "use strict"; (0,_inherits/* default */.Z)(Token, BaseCurrency); var _super = (0,_create_super/* default */.Z)(Token); function Token(chainId, address, decimals, symbol, name, projectLink) { (0,_class_call_check/* default */.Z)(this, Token); var _this; _this = _super.call(this, chainId, decimals, symbol, name); _this.isNative = false; _this.isToken = true; _this.address = validateAndParseAddress(address); _this.projectLink = projectLink; return _this; } var _proto = Token.prototype; /** * Returns true if the two tokens are equivalent, i.e. have the same chainId and address. * @param other other token to compare */ _proto.equals = function equals(other) { return other.isToken && this.chainId === other.chainId && this.address === other.address; }; /** * Returns true if the address of this token sorts before the address of the other token * @param other other token to compare * @throws if the tokens have the same address * @throws if the tokens are on different chains */ _proto.sortsBefore = function sortsBefore(other) { invariant(this.chainId === other.chainId, "CHAIN_IDS"); invariant(this.address !== other.address, "ADDRESSES"); return this.address.toLowerCase() < other.address.toLowerCase(); }; (0,_create_class/* default */.Z)(Token, [ { key: "wrapped", get: /** * Return this token, which does not need to be wrapped */ function get() { return this; } }, { key: "serialize", get: function get() { return { address: this.address, chainId: this.chainId, decimals: this.decimals, symbol: this.symbol, name: this.name, projectLink: this.projectLink }; } } ]); return Token; }(BaseCurrency); ;// CONCATENATED MODULE: ./packages/swap-sdk/src/constants.ts var ChainId; (function(ChainId) { ChainId[ChainId["ETHEREUM"] = 1] = "ETHEREUM"; ChainId[ChainId["RINKEBY"] = 4] = "RINKEBY"; ChainId[ChainId["GOERLI"] = 5] = "GOERLI"; ChainId[ChainId["CRONOS"] = 25] = "CRONOS"; ChainId[ChainId["BSC"] = 56] = "BSC"; ChainId[ChainId["BSC_TESTNET"] = 97] = "BSC_TESTNET"; })(ChainId || (ChainId = {})); var TradeType; (function(TradeType) { TradeType[TradeType["EXACT_INPUT"] = 0] = "EXACT_INPUT"; TradeType[TradeType["EXACT_OUTPUT"] = 1] = "EXACT_OUTPUT"; })(TradeType || (TradeType = {})); var Rounding; (function(Rounding) { Rounding[Rounding["ROUND_DOWN"] = 0] = "ROUND_DOWN"; Rounding[Rounding["ROUND_HALF_UP"] = 1] = "ROUND_HALF_UP"; Rounding[Rounding["ROUND_UP"] = 2] = "ROUND_UP"; })(Rounding || (Rounding = {})); var FACTORY_ADDRESS = "0xd590cC180601AEcD6eeADD9B7f2B7611519544f4"; var FACTORY_ADDRESS_BSC = "0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73"; // // TODO: ETH This is test version, do not depends on it var FACTORY_ADDRESS_ETH = "0xD93801d7D3a368D94A3A32E97A20f7aC1948a5dB"; var _obj; var FACTORY_ADDRESS_MAP = (_obj = {}, (0,_define_property/* default */.Z)(_obj, ChainId.ETHEREUM, FACTORY_ADDRESS_ETH), (0,_define_property/* default */.Z)(_obj, ChainId.RINKEBY, FACTORY_ADDRESS_ETH), (0,_define_property/* default */.Z)(_obj, ChainId.GOERLI, FACTORY_ADDRESS_ETH), (0,_define_property/* default */.Z)(_obj, ChainId.CRONOS, FACTORY_ADDRESS), (0,_define_property/* default */.Z)(_obj, ChainId.BSC, FACTORY_ADDRESS_BSC), (0,_define_property/* default */.Z)(_obj, ChainId.BSC_TESTNET, "0x6725f303b657a9451d8ba641348b6761a6cc7a17"), _obj); var INIT_CODE_HASH = "0x00fb7f630766e6a796048ea87d01acd3068e8ff67d078148a3fa3f4a84f69bd5"; var INIT_CODE_HASH_ETH = "0x57224589c67f3f30a6b0d7a1b54cf3153ab84563bc609ef41dfb34f8b2974d2d"; var _obj1; var INIT_CODE_HASH_MAP = (_obj1 = {}, (0,_define_property/* default */.Z)(_obj1, ChainId.ETHEREUM, INIT_CODE_HASH_ETH), (0,_define_property/* default */.Z)(_obj1, ChainId.RINKEBY, INIT_CODE_HASH_ETH), (0,_define_property/* default */.Z)(_obj1, ChainId.GOERLI, INIT_CODE_HASH_ETH), (0,_define_property/* default */.Z)(_obj1, ChainId.CRONOS, "0x7ae6954210575e79ea2402d23bc6a59c4146a6e6296118aa8b99c747afec8acf"), (0,_define_property/* default */.Z)(_obj1, ChainId.BSC, INIT_CODE_HASH), (0,_define_property/* default */.Z)(_obj1, ChainId.BSC_TESTNET, "0xd0d4c4cd0848c93cb4fd1f498d7013ee6bfb25783ea21593d5834f5d250ece66"), _obj1); var MINIMUM_LIQUIDITY = jsbi_umd_default().BigInt(1000); // exports for internal consumption var ZERO = jsbi_umd_default().BigInt(0); var ONE = jsbi_umd_default().BigInt(1); var TWO = jsbi_umd_default().BigInt(2); var THREE = jsbi_umd_default().BigInt(3); var FIVE = jsbi_umd_default().BigInt(5); var TEN = jsbi_umd_default().BigInt(10); var _100 = jsbi_umd_default().BigInt(100); var _9975 = jsbi_umd_default().BigInt(9975); var _10000 = jsbi_umd_default().BigInt(10000); var MaxUint256 = jsbi_umd_default().BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); var SolidityType; (function(SolidityType) { SolidityType["uint8"] = "uint8"; SolidityType["uint256"] = "uint256"; })(SolidityType || (SolidityType = {})); var _obj2; var SOLIDITY_TYPE_MAXIMA = (_obj2 = {}, (0,_define_property/* default */.Z)(_obj2, SolidityType.uint8, jsbi_umd_default().BigInt("0xff")), (0,_define_property/* default */.Z)(_obj2, SolidityType.uint256, jsbi_umd_default().BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")), _obj2); var _obj3; var WETH9 = (_obj3 = {}, (0,_define_property/* default */.Z)(_obj3, ChainId.ETHEREUM, new Token(ChainId.ETHEREUM, "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", 18, "WETH", "Wrapped Ether", "https://weth.io")), (0,_define_property/* default */.Z)(_obj3, ChainId.RINKEBY, new Token(ChainId.RINKEBY, "0xc778417E063141139Fce010982780140Aa0cD5Ab", 18, "WETH", "Wrapped Ether", "https://weth.io")), (0,_define_property/* default */.Z)(_obj3, ChainId.GOERLI, new Token(ChainId.GOERLI, "0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6", 18, "WETH", "Wrapped Ether", "https://weth.io")), _obj3); var _obj4; var WBNB = (_obj4 = {}, (0,_define_property/* default */.Z)(_obj4, ChainId.ETHEREUM, new Token(ChainId.ETHEREUM, "0x418D75f65a02b3D53B2418FB8E1fe493759c7605", 18, "WBNB", "Wrapped BNB", "https://www.binance.org")), (0,_define_property/* default */.Z)(_obj4, ChainId.BSC, new Token(ChainId.BSC, "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", 18, "WBNB", "Wrapped BNB", "https://www.binance.org")), (0,_define_property/* default */.Z)(_obj4, ChainId.BSC_TESTNET, new Token(ChainId.BSC_TESTNET, "0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd", 18, "WBNB", "Wrapped BNB", "https://www.binance.org")), _obj4); var WCRO = (0,_define_property/* default */.Z)({}, ChainId.CRONOS, new Token(ChainId.CRONOS, "0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23", 18, "WCRO", "Wrapped CRO", "https://chain.crypto.com")); var _obj5; var WNATIVE = (_obj5 = {}, (0,_define_property/* default */.Z)(_obj5, ChainId.ETHEREUM, WETH9[ChainId.ETHEREUM]), (0,_define_property/* default */.Z)(_obj5, ChainId.RINKEBY, WETH9[ChainId.RINKEBY]), (0,_define_property/* default */.Z)(_obj5, ChainId.GOERLI, WETH9[ChainId.GOERLI]), (0,_define_property/* default */.Z)(_obj5, ChainId.CRONOS, WCRO[ChainId.CRONOS]), (0,_define_property/* default */.Z)(_obj5, ChainId.BSC, WBNB[ChainId.BSC]), (0,_define_property/* default */.Z)(_obj5, ChainId.BSC_TESTNET, WBNB[ChainId.BSC_TESTNET]), _obj5); var _obj6; var NATIVE = (_obj6 = {}, (0,_define_property/* default */.Z)(_obj6, ChainId.ETHEREUM, { name: "Ether", symbol: "ETH", decimals: 18 }), (0,_define_property/* default */.Z)(_obj6, ChainId.RINKEBY, { name: "Rinkeby Ether", symbol: "RIN", decimals: 18 }), (0,_define_property/* default */.Z)(_obj6, ChainId.GOERLI, { name: "Goerli Ether", symbol: "GOR", decimals: 18 }), (0,_define_property/* default */.Z)(_obj6, ChainId.CRONOS, { name: "CRO", symbol: "CRO", decimals: 18 }), (0,_define_property/* default */.Z)(_obj6, ChainId.BSC, { name: "Binance Chain Native Token", symbol: "BNB", decimals: 18 }), (0,_define_property/* default */.Z)(_obj6, ChainId.BSC_TESTNET, { name: "Binance Chain Native Token", symbol: "tBNB", decimals: 18 }), _obj6); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_assert_this_initialized.mjs var _assert_this_initialized = __webpack_require__(4111); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_instanceof.mjs var src_instanceof = __webpack_require__(82670); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_wrap_native_super.mjs + 2 modules var _wrap_native_super = __webpack_require__(25892); ;// CONCATENATED MODULE: ./packages/swap-sdk/src/errors.ts // see https://stackoverflow.com/a/41102306 var CAN_SET_PROTOTYPE = "setPrototypeOf" in Object; /** * Indicates that the pair has insufficient reserves for a desired output amount. I.e. the amount of output cannot be * obtained by sending any amount of input. */ var InsufficientReservesError = /*#__PURE__*/ function _target(Error1) { "use strict"; (0,_inherits/* default */.Z)(InsufficientReservesError, Error1); var _super = (0,_create_super/* default */.Z)(InsufficientReservesError); function InsufficientReservesError() { (0,_class_call_check/* default */.Z)(this, InsufficientReservesError); var _this; _this = _super.call(this); _this.isInsufficientReservesError = true; _this.name = _this.constructor.name; if (CAN_SET_PROTOTYPE) Object.setPrototypeOf((0,_assert_this_initialized/* default */.Z)(_this), ((0,src_instanceof/* default */.Z)(this, InsufficientReservesError) ? this.constructor : void 0).prototype); return _this; } return InsufficientReservesError; }((0,_wrap_native_super/* default */.Z)(Error)); /** * Indicates that the input amount is too small to produce any amount of output. I.e. the amount of input sent is less * than the price of a single unit of output after fees. */ var InsufficientInputAmountError = /*#__PURE__*/ function _target(Error1) { "use strict"; (0,_inherits/* default */.Z)(InsufficientInputAmountError, Error1); var _super = (0,_create_super/* default */.Z)(InsufficientInputAmountError); function InsufficientInputAmountError() { (0,_class_call_check/* default */.Z)(this, InsufficientInputAmountError); var _this; _this = _super.call(this); _this.isInsufficientInputAmountError = true; _this.name = _this.constructor.name; if (CAN_SET_PROTOTYPE) Object.setPrototypeOf((0,_assert_this_initialized/* default */.Z)(_this), ((0,src_instanceof/* default */.Z)(this, InsufficientInputAmountError) ? this.constructor : void 0).prototype); return _this; } return InsufficientInputAmountError; }((0,_wrap_native_super/* default */.Z)(Error)); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_spread.mjs var _object_spread = __webpack_require__(26042); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_spread_props.mjs var _object_spread_props = __webpack_require__(69396); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_sliced_to_array.mjs + 2 modules var _sliced_to_array = __webpack_require__(828); // EXTERNAL MODULE: ./node_modules/@ethersproject/solidity/lib.esm/index.js + 1 modules var solidity_lib_esm = __webpack_require__(31886); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_get_prototype_of.mjs var _get_prototype_of = __webpack_require__(82662); ;// CONCATENATED MODULE: ./node_modules/@swc/helpers/src/_super_prop_base.mjs function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = (0,_get_prototype_of/* default */.Z)(object); if (object === null) break; } return object; } ;// CONCATENATED MODULE: ./node_modules/@swc/helpers/src/_get.mjs function get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { get = Reflect.get; } else { get = function get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver || target); } return desc.value; }; } return get(target, property, receiver); } function _get(target, property, receiver) { return get(target, property, receiver); } // EXTERNAL MODULE: ./node_modules/decimal.js-light/decimal.js var decimal = __webpack_require__(29887); var decimal_default = /*#__PURE__*/__webpack_require__.n(decimal); // EXTERNAL MODULE: ./node_modules/big.js/big.js var big = __webpack_require__(93302); var big_default = /*#__PURE__*/__webpack_require__.n(big); // EXTERNAL MODULE: ./node_modules/toformat/toFormat.js var toFormat = __webpack_require__(12447); var toFormat_default = /*#__PURE__*/__webpack_require__.n(toFormat); ;// CONCATENATED MODULE: ./packages/swap-sdk/src/entities/fractions/fraction.ts var Decimal = toFormat_default()((decimal_default())); var Big = toFormat_default()((big_default())); var fraction_obj; var toSignificantRounding = (fraction_obj = {}, (0,_define_property/* default */.Z)(fraction_obj, Rounding.ROUND_DOWN, Decimal.ROUND_DOWN), (0,_define_property/* default */.Z)(fraction_obj, Rounding.ROUND_HALF_UP, Decimal.ROUND_HALF_UP), (0,_define_property/* default */.Z)(fraction_obj, Rounding.ROUND_UP, Decimal.ROUND_UP), fraction_obj); var RoundingMode; (function(RoundingMode) { RoundingMode[RoundingMode[/** * Rounds towards zero. * I.e. truncate, no rounding. */ "RoundDown"] = 0] = "RoundDown"; RoundingMode[RoundingMode[/** * Rounds towards nearest neighbour. * If equidistant, rounds away from zero. */ "RoundHalfUp"] = 1] = "RoundHalfUp"; RoundingMode[RoundingMode[/** * Rounds towards nearest neighbour. * If equidistant, rounds towards even neighbour. */ "RoundHalfEven"] = 2] = "RoundHalfEven"; RoundingMode[RoundingMode[/** * Rounds away from zero. */ "RoundUp"] = 3] = "RoundUp"; })(RoundingMode || (RoundingMode = {})); var fraction_obj1; var toFixedRounding = (fraction_obj1 = {}, (0,_define_property/* default */.Z)(fraction_obj1, Rounding.ROUND_DOWN, 0), (0,_define_property/* default */.Z)(fraction_obj1, Rounding.ROUND_HALF_UP, 1), (0,_define_property/* default */.Z)(fraction_obj1, Rounding.ROUND_UP, 3), fraction_obj1); var Fraction = /*#__PURE__*/ function() { "use strict"; function Fraction(numerator) { var denominator = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : jsbi_umd_default().BigInt(1); (0,_class_call_check/* default */.Z)(this, Fraction); this.numerator = jsbi_umd_default().BigInt(numerator); this.denominator = jsbi_umd_default().BigInt(denominator); } var _proto = Fraction.prototype; _proto.invert = function invert() { return new Fraction(this.denominator, this.numerator); }; _proto.add = function add(other) { var otherParsed = Fraction.tryParseFraction(other); if (jsbi_umd_default().equal(this.denominator, otherParsed.denominator)) { return new Fraction(jsbi_umd_default().add(this.numerator, otherParsed.numerator), this.denominator); } return new Fraction(jsbi_umd_default().add(jsbi_umd_default().multiply(this.numerator, otherParsed.denominator), jsbi_umd_default().multiply(otherParsed.numerator, this.denominator)), jsbi_umd_default().multiply(this.denominator, otherParsed.denominator)); }; _proto.subtract = function subtract(other) { var otherParsed = Fraction.tryParseFraction(other); if (jsbi_umd_default().equal(this.denominator, otherParsed.denominator)) { return new Fraction(jsbi_umd_default().subtract(this.numerator, otherParsed.numerator), this.denominator); } return new Fraction(jsbi_umd_default().subtract(jsbi_umd_default().multiply(this.numerator, otherParsed.denominator), jsbi_umd_default().multiply(otherParsed.numerator, this.denominator)), jsbi_umd_default().multiply(this.denominator, otherParsed.denominator)); }; _proto.lessThan = function lessThan(other) { var otherParsed = Fraction.tryParseFraction(other); return jsbi_umd_default().lessThan(jsbi_umd_default().multiply(this.numerator, otherParsed.denominator), jsbi_umd_default().multiply(otherParsed.numerator, this.denominator)); }; _proto.equalTo = function equalTo(other) { var otherParsed = Fraction.tryParseFraction(other); return jsbi_umd_default().equal(jsbi_umd_default().multiply(this.numerator, otherParsed.denominator), jsbi_umd_default().multiply(otherParsed.numerator, this.denominator)); }; _proto.greaterThan = function greaterThan(other) { var otherParsed = Fraction.tryParseFraction(other); return jsbi_umd_default().greaterThan(jsbi_umd_default().multiply(this.numerator, otherParsed.denominator), jsbi_umd_default().multiply(otherParsed.numerator, this.denominator)); }; _proto.multiply = function multiply(other) { var otherParsed = Fraction.tryParseFraction(other); return new Fraction(jsbi_umd_default().multiply(this.numerator, otherParsed.numerator), jsbi_umd_default().multiply(this.denominator, otherParsed.denominator)); }; _proto.divide = function divide(other) { var otherParsed = Fraction.tryParseFraction(other); return new Fraction(jsbi_umd_default().multiply(this.numerator, otherParsed.denominator), jsbi_umd_default().multiply(this.denominator, otherParsed.numerator)); }; _proto.toSignificant = function toSignificant(significantDigits) { var format = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { groupSeparator: "" }, rounding = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Rounding.ROUND_HALF_UP; invariant(Number.isInteger(significantDigits), "".concat(significantDigits, " is not an integer.")); invariant(significantDigits > 0, "".concat(significantDigits, " is not positive.")); Decimal.set({ precision: significantDigits + 1, rounding: toSignificantRounding[rounding] }); var quotient = new Decimal(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(significantDigits); return quotient.toFormat(quotient.decimalPlaces(), format); }; _proto.toFixed = function toFixed(decimalPlaces) { var format = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { groupSeparator: "" }, rounding = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Rounding.ROUND_HALF_UP; invariant(Number.isInteger(decimalPlaces), "".concat(decimalPlaces, " is not an integer.")); invariant(decimalPlaces >= 0, "".concat(decimalPlaces, " is negative.")); Big.DP = decimalPlaces; Big.RM = toFixedRounding[rounding]; return new Big(this.numerator.toString()).div(this.denominator.toString()).toFormat(decimalPlaces, format); }; Fraction.tryParseFraction = function tryParseFraction(fractionish) { if ((0,src_instanceof/* default */.Z)(fractionish, (jsbi_umd_default())) || typeof fractionish === "number" || typeof fractionish === "string") return new Fraction(fractionish); if ("numerator" in fractionish && "denominator" in fractionish) return fractionish; throw new Error("Could not parse fraction"); }; (0,_create_class/* default */.Z)(Fraction, [ { key: "quotient", get: function get() { return jsbi_umd_default().divide(this.numerator, this.denominator); } }, { key: "remainder", get: function get() { return new Fraction(jsbi_umd_default().remainder(this.numerator, this.denominator), this.denominator); } }, { key: "asFraction", get: /** * Helper method for converting any super class back to a fraction */ function get() { return new Fraction(this.numerator, this.denominator); } } ]); return Fraction; }(); ;// CONCATENATED MODULE: ./packages/swap-sdk/src/entities/fractions/currencyAmount.ts var currencyAmount_Big = toFormat_default()((big_default())); var CurrencyAmount = /*#__PURE__*/ function(Fraction) { "use strict"; (0,_inherits/* default */.Z)(CurrencyAmount, Fraction); var _super = (0,_create_super/* default */.Z)(CurrencyAmount); function CurrencyAmount(currency, numerator, denominator) { (0,_class_call_check/* default */.Z)(this, CurrencyAmount); var _this; _this = _super.call(this, numerator, denominator); invariant(jsbi_umd_default().lessThanOrEqual(_this.quotient, MaxUint256), "AMOUNT"); _this.currency = currency; _this.decimalScale = jsbi_umd_default().exponentiate(jsbi_umd_default().BigInt(10), jsbi_umd_default().BigInt(currency.decimals)); return _this; } var _proto = CurrencyAmount.prototype; _proto.add = function add(other) { invariant(this.currency.equals(other.currency), "CURRENCY"); var added = _get((0,_get_prototype_of/* default */.Z)(CurrencyAmount.prototype), "add", this).call(this, other); return CurrencyAmount.fromFractionalAmount(this.currency, added.numerator, added.denominator); }; _proto.subtract = function subtract(other) { invariant(this.currency.equals(other.currency), "CURRENCY"); var subtracted = _get((0,_get_prototype_of/* default */.Z)(CurrencyAmount.prototype), "subtract", this).call(this, other); return CurrencyAmount.fromFractionalAmount(this.currency, subtracted.numerator, subtracted.denominator); }; _proto.multiply = function multiply(other) { var multiplied = _get((0,_get_prototype_of/* default */.Z)(CurrencyAmount.prototype), "multiply", this).call(this, other); return CurrencyAmount.fromFractionalAmount(this.currency, multiplied.numerator, multiplied.denominator); }; _proto.divide = function divide(other) { var divided = _get((0,_get_prototype_of/* default */.Z)(CurrencyAmount.prototype), "divide", this).call(this, other); return CurrencyAmount.fromFractionalAmount(this.currency, divided.numerator, divided.denominator); }; _proto.toSignificant = function toSignificant() { var significantDigits = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 6, format = arguments.length > 1 ? arguments[1] : void 0, rounding = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Rounding.ROUND_DOWN; return _get((0,_get_prototype_of/* default */.Z)(CurrencyAmount.prototype), "divide", this).call(this, this.decimalScale).toSignificant(significantDigits, format, rounding); }; _proto.toFixed = function toFixed() { var decimalPlaces = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.currency.decimals, format = arguments.length > 1 ? arguments[1] : void 0, rounding = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Rounding.ROUND_DOWN; invariant(decimalPlaces <= this.currency.decimals, "DECIMALS"); return _get((0,_get_prototype_of/* default */.Z)(CurrencyAmount.prototype), "divide", this).call(this, this.decimalScale).toFixed(decimalPlaces, format, rounding); }; _proto.toExact = function toExact() { var format = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { groupSeparator: "" }; currencyAmount_Big.DP = this.currency.decimals; return new currencyAmount_Big(this.quotient.toString()).div(this.decimalScale.toString()).toFormat(format); }; /** * Returns a new currency amount instance from the unitless amount of token, i.e. the raw amount * @param currency the currency in the amount * @param rawAmount the raw token or ether amount */ CurrencyAmount.fromRawAmount = function fromRawAmount(currency, rawAmount) { return new CurrencyAmount(currency, rawAmount); }; /** * Construct a currency amount with a denominator that is not equal to 1 * @param currency the currency * @param numerator the numerator of the fractional token amount * @param denominator the denominator of the fractional token amount */ CurrencyAmount.fromFractionalAmount = function fromFractionalAmount(currency, numerator, denominator) { return new CurrencyAmount(currency, numerator, denominator); }; (0,_create_class/* default */.Z)(CurrencyAmount, [ { key: "wrapped", get: function get() { if (this.currency.isToken) return this; return CurrencyAmount.fromFractionalAmount(this.currency.wrapped, this.numerator, this.denominator); } } ]); return CurrencyAmount; }(Fraction); ;// CONCATENATED MODULE: ./packages/swap-sdk/src/entities/fractions/price.ts var Price = /*#__PURE__*/ function(Fraction1) { "use strict"; (0,_inherits/* default */.Z)(Price, Fraction1); var _super = (0,_create_super/* default */.Z)(Price); function Price() { for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){ args[_key] = arguments[_key]; } (0,_class_call_check/* default */.Z)(this, Price); var _this; var baseCurrency, quoteCurrency, denominator, numerator; if (args.length === 4) { var ref; ref = (0,_sliced_to_array/* default */.Z)(args, 4), baseCurrency = ref[0], quoteCurrency = ref[1], denominator = ref[2], numerator = ref[3], ref; } else { var result = args[0].quoteAmount.divide(args[0].baseAmount); var ref1; ref1 = [ args[0].baseAmount.currency, args[0].quoteAmount.currency, result.denominator, result.numerator, ], baseCurrency = ref1[0], quoteCurrency = ref1[1], denominator = ref1[2], numerator = ref1[3], ref1; } _this = _super.call(this, numerator, denominator); _this.baseCurrency = baseCurrency; _this.quoteCurrency = quoteCurrency; _this.scalar = new Fraction(jsbi_umd_default().exponentiate(jsbi_umd_default().BigInt(10), jsbi_umd_default().BigInt(baseCurrency.decimals)), jsbi_umd_default().exponentiate(jsbi_umd_default().BigInt(10), jsbi_umd_default().BigInt(quoteCurrency.decimals))); return _this; } var _proto = Price.prototype; /** * Flip the price, switching the base and quote currency */ _proto.invert = function invert() { return new Price(this.quoteCurrency, this.baseCurrency, this.numerator, this.denominator); }; /** * Multiply the price by another price, returning a new price. The other price must have the same base currency as this price's quote currency * @param other the other price */ _proto.multiply = function multiply(other) { invariant(this.quoteCurrency.equals(other.baseCurrency), "TOKEN"); var fraction = _get((0,_get_prototype_of/* default */.Z)(Price.prototype), "multiply", this).call(this, other); return new Price(this.baseCurrency, other.quoteCurrency, fraction.denominator, fraction.numerator); }; /** * Return the amount of quote currency corresponding to a given amount of the base currency * @param currencyAmount the amount of base currency to quote against the price */ _proto.quote = function quote(currencyAmount) { invariant(currencyAmount.currency.equals(this.baseCurrency), "TOKEN"); var result = _get((0,_get_prototype_of/* default */.Z)(Price.prototype), "multiply", this).call(this, currencyAmount); return CurrencyAmount.fromFractionalAmount(this.quoteCurrency, result.numerator, result.denominator); }; _proto.toSignificant = function toSignificant() { var significantDigits = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 6, format = arguments.length > 1 ? arguments[1] : void 0, rounding = arguments.length > 2 ? arguments[2] : void 0; return this.adjustedForDecimals.toSignificant(significantDigits, format, rounding); }; _proto.toFixed = function toFixed() { var decimalPlaces = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 4, format = arguments.length > 1 ? arguments[1] : void 0, rounding = arguments.length > 2 ? arguments[2] : void 0; return this.adjustedForDecimals.toFixed(decimalPlaces, format, rounding); }; (0,_create_class/* default */.Z)(Price, [ { key: "adjustedForDecimals", get: /** * Get the value scaled by decimals for formatting * @private */ function get() { return _get((0,_get_prototype_of/* default */.Z)(Price.prototype), "multiply", this).call(this, this.scalar); } } ]); return Price; }(Fraction); ;// CONCATENATED MODULE: ./packages/swap-sdk/src/entities/fractions/percent.ts var ONE_HUNDRED = new Fraction(jsbi_umd_default().BigInt(100)); /** * Converts a fraction to a percent * @param fraction the fraction to convert */ function toPercent(fraction) { return new Percent(fraction.numerator, fraction.denominator); } var Percent = /*#__PURE__*/ function(Fraction) { "use strict"; (0,_inherits/* default */.Z)(Percent, Fraction); var _super = (0,_create_super/* default */.Z)(Percent); function Percent() { (0,_class_call_check/* default */.Z)(this, Percent); var _this; _this = _super.apply(this, arguments); /** * This boolean prevents a fraction from being interpreted as a Percent */ _this.isPercent = true; return _this; } var _proto = Percent.prototype; _proto.add = function add(other) { return toPercent(_get((0,_get_prototype_of/* default */.Z)(Percent.prototype), "add", this).call(this, other)); }; _proto.subtract = function subtract(other) { return toPercent(_get((0,_get_prototype_of/* default */.Z)(Percent.prototype), "subtract", this).call(this, other)); }; _proto.multiply = function multiply(other) { return toPercent(_get((0,_get_prototype_of/* default */.Z)(Percent.prototype), "multiply", this).call(this, other)); }; _proto.divide = function divide(other) { return toPercent(_get((0,_get_prototype_of/* default */.Z)(Percent.prototype), "divide", this).call(this, other)); }; _proto.toSignificant = function toSignificant() { var significantDigits = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 5, format = arguments.length > 1 ? arguments[1] : void 0, rounding = arguments.length > 2 ? arguments[2] : void 0; return _get((0,_get_prototype_of/* default */.Z)(Percent.prototype), "multiply", this).call(this, ONE_HUNDRED).toSignificant(significantDigits, format, rounding); }; _proto.toFixed = function toFixed() { var decimalPlaces = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 2, format = arguments.length > 1 ? arguments[1] : void 0, rounding = arguments.length > 2 ? arguments[2] : void 0; return _get((0,_get_prototype_of/* default */.Z)(Percent.prototype), "multiply", this).call(this, ONE_HUNDRED).toFixed(decimalPlaces, format, rounding); }; return Percent; }(Fraction); ;// CONCATENATED MODULE: ./packages/swap-sdk/src/entities/fractions/index.ts ;// CONCATENATED MODULE: ./packages/swap-sdk/src/entities/pair.ts var PAIR_ADDRESS_CACHE = {}; var composeKey = function composeKey(token0, token1) { return "".concat(token0.chainId, "-").concat(token0.address, "-").concat(token1.address); }; var computePairAddress = function computePairAddress(param) { var factoryAddress = param.factoryAddress, tokenA = param.tokenA, tokenB = param.tokenB; var ref // does safety checks = (0,_sliced_to_array/* default */.Z)(tokenA.sortsBefore(tokenB) ? [ tokenA, tokenB ] : [ tokenB, tokenA ], 2), token0 = ref[0], token1 = ref[1]; var key = composeKey(token0, token1); if ((PAIR_ADDRESS_CACHE === null || PAIR_ADDRESS_CACHE === void 0 ? void 0 : PAIR_ADDRESS_CACHE[key]) === undefined) { PAIR_ADDRESS_CACHE = (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({}, PAIR_ADDRESS_CACHE), (0,_define_property/* default */.Z)({}, key, (0,lib_esm.getCreate2Address)(factoryAddress, (0,solidity_lib_esm.keccak256)([ "bytes" ], [ (0,solidity_lib_esm.pack)([ "address", "address" ], [ token0.address, token1.address ]) ]), INIT_CODE_HASH_MAP[token0.chainId]))); } return PAIR_ADDRESS_CACHE[key]; }; var Pair = /*#__PURE__*/ function() { "use strict"; function Pair(currencyAmountA, tokenAmountB) { (0,_class_call_check/* default */.Z)(this, Pair); var tokenAmounts = currencyAmountA.currency.sortsBefore(tokenAmountB.currency) // does safety checks ? [ currencyAmountA, tokenAmountB ] : [ tokenAmountB, currencyAmountA ]; this.liquidityToken = new Token(tokenAmounts[0].currency.chainId, Pair.getAddress(tokenAmounts[0].currency, tokenAmounts[1].currency), 18, "Cake-LP", "Pancake LPs"); this.tokenAmounts = tokenAmounts; } var _proto = Pair.prototype; /** * Returns true if the token is either token0 or token1 * @param token to check */ _proto.involvesToken = function involvesToken(token) { return token.equals(this.token0) || token.equals(this.token1); }; /** * Return the price of the given token in terms of the other token in the pair. * @param token token to return price of */ _proto.priceOf = function priceOf(token) { invariant(this.involvesToken(token), "TOKEN"); return token.equals(this.token0) ? this.token0Price : this.token1Price; }; _proto.reserveOf = function reserveOf(token) { invariant(this.involvesToken(token), "TOKEN"); return token.equals(this.token0) ? this.reserve0 : this.reserve1; }; _proto.getOutputAmount = function getOutputAmount(inputAmount) { invariant(this.involvesToken(inputAmount.currency), "TOKEN"); if (jsbi_umd_default().equal(this.reserve0.quotient, ZERO) || jsbi_umd_default().equal(this.reserve1.quotient, ZERO)) { throw new InsufficientReservesError(); } var inputReserve = this.reserveOf(inputAmount.currency); var outputReserve = this.reserveOf(inputAmount.currency.equals(this.token0) ? this.token1 : this.token0); var inputAmountWithFee = jsbi_umd_default().multiply(inputAmount.quotient, _9975); var numerator = jsbi_umd_default().multiply(inputAmountWithFee, outputReserve.quotient); var denominator = jsbi_umd_default().add(jsbi_umd_default().multiply(inputReserve.quotient, _10000), inputAmountWithFee); var outputAmount = CurrencyAmount.fromRawAmount(inputAmount.currency.equals(this.token0) ? this.token1 : this.token0, jsbi_umd_default().divide(numerator, denominator)); if (jsbi_umd_default().equal(outputAmount.quotient, ZERO)) { throw new InsufficientInputAmountError(); } return [ outputAmount, new Pair(inputReserve.add(inputAmount), outputReserve.subtract(outputAmount)) ]; }; _proto.getInputAmount = function getInputAmount(outputAmount) { invariant(this.involvesToken(outputAmount.currency), "TOKEN"); if (jsbi_umd_default().equal(this.reserve0.quotient, ZERO) || jsbi_umd_default().equal(this.reserve1.quotient, ZERO) || jsbi_umd_default().greaterThanOrEqual(outputAmount.quotient, this.reserveOf(outputAmount.currency).quotient)) { throw new InsufficientReservesError(); } var outputReserve = this.reserveOf(outputAmount.currency); var inputReserve = this.reserveOf(outputAmount.currency.equals(this.token0) ? this.token1 : this.token0); var numerator = jsbi_umd_default().multiply(jsbi_umd_default().multiply(inputReserve.quotient, outputAmount.quotient), _10000); var denominator = jsbi_umd_default().multiply(jsbi_umd_default().subtract(outputReserve.quotient, outputAmount.quotient), _9975); var inputAmount = CurrencyAmount.fromRawAmount(outputAmount.currency.equals(this.token0) ? this.token1 : this.token0, jsbi_umd_default().add(jsbi_umd_default().divide(numerator, denominator), ONE)); return [ inputAmount, new Pair(inputReserve.add(inputAmount), outputReserve.subtract(outputAmount)) ]; }; _proto.getLiquidityMinted = function getLiquidityMinted(totalSupply, tokenAmountA, tokenAmountB) { invariant(totalSupply.currency.equals(this.liquidityToken), "LIQUIDITY"); var tokenAmounts = tokenAmountA.currency.sortsBefore(tokenAmountB.currency) // does safety checks ? [ tokenAmountA, tokenAmountB ] : [ tokenAmountB, tokenAmountA ]; invariant(tokenAmounts[0].currency.equals(this.token0) && tokenAmounts[1].currency.equals(this.token1), "TOKEN"); var liquidity; if (jsbi_umd_default().equal(totalSupply.quotient, ZERO)) { liquidity = jsbi_umd_default().subtract(sqrt(jsbi_umd_default().multiply(tokenAmounts[0].quotient, tokenAmounts[1].quotient)), MINIMUM_LIQUIDITY); } else { var amount0 = jsbi_umd_default().divide(jsbi_umd_default().multiply(tokenAmounts[0].quotient, totalSupply.quotient), this.reserve0.quotient); var amount1 = jsbi_umd_default().divide(jsbi_umd_default().multiply(tokenAmounts[1].quotient, totalSupply.quotient), this.reserve1.quotient); liquidity = jsbi_umd_default().lessThanOrEqual(amount0, amount1) ? amount0 : amount1; } if (!jsbi_umd_default().greaterThan(liquidity, ZERO)) { throw new InsufficientInputAmountError(); } return CurrencyAmount.fromRawAmount(this.liquidityToken, liquidity); }; _proto.getLiquidityValue = function getLiquidityValue(token, totalSupply, liquidity) { var feeOn = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false, kLast = arguments.length > 4 ? arguments[4] : void 0; invariant(this.involvesToken(token), "TOKEN"); invariant(totalSupply.currency.equals(this.liquidityToken), "TOTAL_SUPPLY"); invariant(liquidity.currency.equals(this.liquidityToken), "LIQUIDITY"); invariant(jsbi_umd_default().lessThanOrEqual(liquidity.quotient, totalSupply.quotient), "LIQUIDITY"); var totalSupplyAdjusted; if (!feeOn) { totalSupplyAdjusted = totalSupply; } else { invariant(!!kLast, "K_LAST"); var kLastParsed = jsbi_umd_default().BigInt(kLast); if (!jsbi_umd_default().equal(kLastParsed, ZERO)) { var rootK = sqrt(jsbi_umd_default().multiply(this.reserve0.quotient, this.reserve1.quotient)); var rootKLast = sqrt(kLastParsed); if (jsbi_umd_default().greaterThan(rootK, rootKLast)) { var numerator = jsbi_umd_default().multiply(totalSupply.quotient, jsbi_umd_default().subtract(rootK, rootKLast)); var denominator = jsbi_umd_default().add(jsbi_umd_default().multiply(rootK, FIVE), rootKLast); var feeLiquidity = jsbi_umd_default().divide(numerator, denominator); totalSupplyAdjusted = totalSupply.add(CurrencyAmount.fromRawAmount(this.liquidityToken, feeLiquidity)); } else { totalSupplyAdjusted = totalSupply; } } else { totalSupplyAdjusted = totalSupply; } } return CurrencyAmount.fromRawAmount(token, jsbi_umd_default().divide(jsbi_umd_default().multiply(liquidity.quotient, this.reserveOf(token).quotient), totalSupplyAdjusted.quotient)); }; Pair.getAddress = function getAddress(tokenA, tokenB) { return computePairAddress({ factoryAddress: FACTORY_ADDRESS_MAP[tokenA.chainId], tokenA: tokenA, tokenB: tokenB }); }; (0,_create_class/* default */.Z)(Pair, [ { key: "token0Price", get: /** * Returns the current mid price of the pair in terms of token0, i.e. the ratio of reserve1 to reserve0 */ function get() { var result = this.tokenAmounts[1].divide(this.tokenAmounts[0]); return new Price(this.token0, this.token1, result.denominator, result.numerator); } }, { key: "token1Price", get: /** * Returns the current mid price of the pair in terms of token1, i.e. the ratio of reserve0 to reserve1 */ function get() { var result = this.tokenAmounts[0].divide(this.tokenAmounts[1]); return new Price(this.token1, this.token0, result.denominator, result.numerator); } }, { key: "chainId", get: /** * Returns the chain ID of the tokens in the pair. */ function get() { return this.token0.chainId; } }, { key: "token0", get: function get() { return this.tokenAmounts[0].currency; } }, { key: "token1", get: function get() { return this.tokenAmounts[1].currency; } }, { key: "reserve0", get: function get() { return this.tokenAmounts[0]; } }, { key: "reserve1", get: function get() { return this.tokenAmounts[1]; } } ]); return Pair; }(); ;// CONCATENATED MODULE: ./packages/swap-sdk/src/entities/route.ts var Route = /*#__PURE__*/ function() { "use strict"; function Route(pairs, input, output) { (0,_class_call_check/* default */.Z)(this, Route); this._midPrice = null; invariant(pairs.length > 0, "PAIRS"); var chainId = pairs[0].chainId; invariant(pairs.every(function(pair) { return pair.chainId === chainId; }), "CHAIN_IDS"); var wrappedInput = input.wrapped; invariant(pairs[0].involvesToken(wrappedInput), "INPUT"); invariant(typeof output === "undefined" || pairs[pairs.length - 1].involvesToken(output.wrapped), "OUTPUT"); var path = [ wrappedInput ]; var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined; try { for(var _iterator = pairs.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){ var _value = (0,_sliced_to_array/* default */.Z)(_step.value, 2), i = _value[0], pair = _value[1]; var currentInput = path[i]; invariant(currentInput.equals(pair.token0) || currentInput.equals(pair.token1), "PATH"); var _$output = currentInput.equals(pair.token0) ? pair.token1 : pair.token0; path.push(_$output); } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally{ try { if (!_iteratorNormalCompletion && _iterator.return != null) { _iterator.return(); } } finally{ if (_didIteratorError) { throw _iteratorError; } } } this.pairs = pairs; this.path = path; this.input = input; this.output = output; } (0,_create_class/* default */.Z)(Route, [ { key: "midPrice", get: function get() { if (this._midPrice !== null) return this._midPrice; var prices = []; var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined; try { for(var _iterator = this.pairs.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){ var _value = (0,_sliced_to_array/* default */.Z)(_step.value, 2), i = _value[0], pair = _value[1]; prices.push(this.path[i].equals(pair.token0) ? new Price(pair.reserve0.currency, pair.reserve1.currency, pair.reserve0.quotient, pair.reserve1.quotient) : new Price(pair.reserve1.currency, pair.reserve0.currency, pair.reserve1.quotient, pair.reserve0.quotient)); } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally{ try { if (!_iteratorNormalCompletion && _iterator.return != null) { _iterator.return(); } } finally{ if (_didIteratorError) { throw _iteratorError; } } } var reduced = prices.slice(1).reduce(function(accumulator, currentValue) { return accumulator.multiply(currentValue); }, prices[0]); return this._midPrice = new Price(this.input, this.output, reduced.denominator, reduced.numerator); } }, { key: "chainId", get: function get() { return this.pairs[0].chainId; } } ]); return Route; }(); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_to_consumable_array.mjs + 2 modules var _to_consumable_array = __webpack_require__(36305); ;// CONCATENATED MODULE: ./packages/swap-sdk/src/entities/trade.ts // comparator function that allows sorting trades by their output amounts, in decreasing order, and then input amounts // in increasing order. i.e. the best trades have the most outputs for the least inputs and are sorted first function inputOutputComparator(a, b) { // must have same input and output token for comparison invariant(a.inputAmount.currency.equals(b.inputAmount.currency), "INPUT_CURRENCY"); invariant(a.outputAmount.currency.equals(b.outputAmount.currency), "OUTPUT_CURRENCY"); if (a.outputAmount.equalTo(b.outputAmount)) { if (a.inputAmount.equalTo(b.inputAmount)) { return 0; } // trade A requires less input than trade B, so A should come first if (a.inputAmount.lessThan(b.inputAmount)) { return -1; } else { return 1; } } else { // tradeA has less output than trade B, so should come second if (a.outputAmount.lessThan(b.outputAmount)) { return 1; } else { return -1; } } } // extension of the input output comparator that also considers other dimensions of the trade in ranking them function tradeComparator(a, b) { var ioComp = inputOutputComparator(a, b); if (ioComp !== 0) { return ioComp; } // consider lowest slippage next, since these are less likely to fail if (a.priceImpact.lessThan(b.priceImpact)) { return -1; } else if (a.priceImpact.greaterThan(b.priceImpact)) { return 1; } // finally consider the number of hops since each hop costs gas return a.route.path.length - b.route.path.length; } /** * Represents a trade executed against a list of pairs. * Does not account for slippage, i.e. trades that front run this trade and move the price. */ var Trade = /*#__PURE__*/ function() { "use strict"; function Trade(route, amount, tradeType) { (0,_class_call_check/* default */.Z)(this, Trade); this.route = route; this.tradeType = tradeType; var tokenAmounts = new Array(route.path.length); if (tradeType === TradeType.EXACT_INPUT) { invariant(amount.currency.equals(route.input), "INPUT"); tokenAmounts[0] = amount.wrapped; for(var i = 0; i < route.path.length - 1; i++){ var pair = route.pairs[i]; var ref = (0,_sliced_to_array/* default */.Z)(pair.getOutputAmount(tokenAmounts[i]), 1), outputAmount = ref[0]; tokenAmounts[i + 1] = outputAmount; } this.inputAmount = CurrencyAmount.fromFractionalAmount(route.input, amount.numerator, amount.denominator); this.outputAmount = CurrencyAmount.fromFractionalAmount(route.output, tokenAmounts[tokenAmounts.length - 1].numerator, tokenAmounts[tokenAmounts.length - 1].denominator); } else { invariant(amount.currency.equals(route.output), "OUTPUT"); tokenAmounts[tokenAmounts.length - 1] = amount.wrapped; for(var i1 = route.path.length - 1; i1 > 0; i1--){ var pair1 = route.pairs[i1 - 1]; var ref1 = (0,_sliced_to_array/* default */.Z)(pair1.getInputAmount(tokenAmounts[i1]), 1), inputAmount = ref1[0]; tokenAmounts[i1 - 1] = inputAmount; } this.inputAmount = CurrencyAmount.fromFractionalAmount(route.input, tokenAmounts[0].numerator, tokenAmounts[0].denominator); this.outputAmount = CurrencyAmount.fromFractionalAmount(route.output, amount.numerator, amount.denominator); } this.executionPrice = new Price(this.inputAmount.currency, this.outputAmount.currency, this.inputAmount.quotient, this.outputAmount.quotient); this.priceImpact = computePriceImpact(route.midPrice, this.inputAmount, this.outputAmount); } var _proto = Trade.prototype; /** * Get the minimum amount that must be received from this trade for the given slippage tolerance * @param slippageTolerance tolerance of unfavorable slippage from the execution price of this trade */ _proto.minimumAmountOut = function minimumAmountOut(slippageTolerance) { invariant(!slippageTolerance.lessThan(ZERO), "SLIPPAGE_TOLERANCE"); if (this.tradeType === TradeType.EXACT_OUTPUT) { return this.outputAmount; } else { var slippageAdjustedAmountOut = new Fraction(ONE).add(slippageTolerance).invert().multiply(this.outputAmount.quotient).quotient; return CurrencyAmount.fromRawAmount(this.outputAmount.currency, slippageAdjustedAmountOut); } }; /** * Get the maximum amount in that can be spent via this trade for the given slippage tolerance * @param slippageTolerance tolerance of unfavorable slippage from the execution price of this trade */ _proto.maximumAmountIn = function maximumAmountIn(slippageTolerance) { invariant(!slippageTolerance.lessThan(ZERO), "SLIPPAGE_TOLERANCE"); if (this.tradeType === TradeType.EXACT_INPUT) { return this.inputAmount; } else { var slippageAdjustedAmountIn = new Fraction(ONE).add(slippageTolerance).multiply(this.inputAmount.quotient).quotient; return CurrencyAmount.fromRawAmount(this.inputAmount.currency, slippageAdjustedAmountIn); } }; /** * Return the execution price after accounting for slippage tolerance * @param slippageTolerance the allowed tolerated slippage */ _proto.worstExecutionPrice = function worstExecutionPrice(slippageTolerance) { return new Price(this.inputAmount.currency, this.outputAmount.currency, this.maximumAmountIn(slippageTolerance).quotient, this.minimumAmountOut(slippageTolerance).quotient); }; /** * Constructs an exact in trade with the given amount in and route * @param route route of the exact in trade * @param amountIn the amount being passed in */ Trade.exactIn = function exactIn(route, amountIn) { return new Trade(route, amountIn, TradeType.EXACT_INPUT); }; /** * Constructs an exact out trade with the given amount out and route * @param route route of the exact out trade * @param amountOut the amount returned by the trade */ Trade.exactOut = function exactOut(route, amountOut) { return new Trade(route, amountOut, TradeType.EXACT_OUTPUT); }; /** * Given a list of pairs, and a fixed amount in, returns the top `maxNumResults` trades that go from an input token * amount to an output token, making at most `maxHops` hops. * Note this does not consider aggregation, as routes are linear. It's possible a better route exists by splitting * the amount in among multiple routes. * @param pairs the pairs to consider in finding the best trade * @param nextAmountIn exact amount of input currency to spend * @param currencyOut the desired currency out * @param maxNumResults maximum number of results to return * @param maxHops maximum number of hops a returned trade can make, e.g. 1 hop goes through a single pair * @param currentPairs used in recursion; the current list of pairs * @param currencyAmountIn used in recursion; the original value of the currencyAmountIn parameter * @param bestTrades used in recursion; the current list of best trades */ Trade.bestTradeExactIn = function bestTradeExactIn(pairs, currencyAmountIn, currencyOut) { var ref = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}, _maxNumResults = ref.maxNumResults, maxNumResults = _maxNumResults === void 0 ? 3 : _maxNumResults, _maxHops = ref.maxHops, maxHops = _maxHops === void 0 ? 3 : _maxHops, currentPairs = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : [], nextAmountIn = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : currencyAmountIn, bestTrades = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : []; invariant(pairs.length > 0, "PAIRS"); invariant(maxHops > 0, "MAX_HOPS"); invariant(currencyAmountIn === nextAmountIn || currentPairs.length > 0, "INVALID_RECURSION"); var amountIn = nextAmountIn.wrapped; var tokenOut = currencyOut.wrapped; for(var i = 0; i < pairs.length; i++){ var pair = pairs[i]; // pair irrelevant if (!pair.token0.equals(amountIn.currency) && !pair.token1.equals(amountIn.currency)) continue; if (pair.reserve0.equalTo(ZERO) || pair.reserve1.equalTo(ZERO)) continue; var amountOut = void 0; try { var ref1; ref1 = (0,_sliced_to_array/* default */.Z)(pair.getOutputAmount(amountIn), 1), amountOut = ref1[0], ref1; } catch (error) { // input too low if (error.isInsufficientInputAmountError) { continue; } throw error; } // we have arrived at the output token, so this is the final trade of one of the paths if (amountOut.currency.equals(tokenOut)) { sortedInsert(bestTrades, new Trade(new Route((0,_to_consumable_array/* default */.Z)(currentPairs).concat([ pair ]), currencyAmountIn.currency, currencyOut), currencyAmountIn, TradeType.EXACT_INPUT), maxNumResults, tradeComparator); } else if (maxHops > 1 && pairs.length > 1) { var pairsExcludingThisPair = pairs.slice(0, i).concat(pairs.slice(i + 1, pairs.length)); // otherwise, consider all the other paths that lead from this token as long as we have not exceeded maxHops Trade.bestTradeExactIn(pairsExcludingThisPair, currencyAmountIn, currencyOut, { maxNumResults: maxNumResults, maxHops: maxHops - 1 }, (0,_to_consumable_array/* default */.Z)(currentPairs).concat([ pair ]), amountOut, bestTrades); } } return bestTrades; }; /** * similar to the above method but instead targets a fixed output amount * given a list of pairs, and a fixed amount out, returns the top `maxNumResults` trades that go from an input token * to an output token amount, making at most `maxHops` hops * note this does not consider aggregation, as routes are linear. it's possible a better route exists by splitting * the amount in among multiple routes. * @param pairs the pairs to consider in finding the best trade * @param currencyIn the currency to spend * @param nextAmountOut the exact amount of currency out * @param maxNumResults maximum number of results to return * @param maxHops maximum number of hops a returned trade can make, e.g. 1 hop goes through a single pair * @param currentPairs used in recursion; the current list of pairs * @param currencyAmountOut used in recursion; the original value of the currencyAmountOut parameter * @param bestTrades used in recursion; the current list of best trades */ Trade.bestTradeExactOut = function bestTradeExactOut(pairs, currencyIn, currencyAmountOut) { var ref = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}, _maxNumResults = ref.maxNumResults, maxNumResults = _maxNumResults === void 0 ? 3 : _maxNumResults, _maxHops = ref.maxHops, maxHops = _maxHops === void 0 ? 3 : _maxHops, currentPairs = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : [], nextAmountOut = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : currencyAmountOut, bestTrades = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : []; invariant(pairs.length > 0, "PAIRS"); invariant(maxHops > 0, "MAX_HOPS"); invariant(currencyAmountOut === nextAmountOut || currentPairs.length > 0, "INVALID_RECURSION"); var amountOut = nextAmountOut.wrapped; var tokenIn = currencyIn.wrapped; for(var i = 0; i < pairs.length; i++){ var pair = pairs[i]; // pair irrelevant if (!pair.token0.equals(amountOut.currency) && !pair.token1.equals(amountOut.currency)) continue; if (pair.reserve0.equalTo(ZERO) || pair.reserve1.equalTo(ZERO)) continue; var amountIn = void 0; try { var ref1; ref1 = (0,_sliced_to_array/* default */.Z)(pair.getInputAmount(amountOut), 1), amountIn = ref1[0], ref1; } catch (error) { // not enough liquidity in this pair if (error.isInsufficientReservesError) { continue; } throw error; } // we have arrived at the input token, so this is the first trade of one of the paths if (amountIn.currency.equals(tokenIn)) { sortedInsert(bestTrades, new Trade(new Route([ pair ].concat((0,_to_consumable_array/* default */.Z)(currentPairs)), currencyIn, currencyAmountOut.currency), currencyAmountOut, TradeType.EXACT_OUTPUT), maxNumResults, tradeComparator); } else if (maxHops > 1 && pairs.length > 1) { var pairsExcludingThisPair = pairs.slice(0, i).concat(pairs.slice(i + 1, pairs.length)); // otherwise, consider all the other paths that arrive at this token as long as we have not exceeded maxHops Trade.bestTradeExactOut(pairsExcludingThisPair, currencyIn, currencyAmountOut, { maxNumResults: maxNumResults, maxHops: maxHops - 1 }, [ pair ].concat((0,_to_consumable_array/* default */.Z)(currentPairs)), amountIn, bestTrades); } } return bestTrades; }; return Trade; }(); ;// CONCATENATED MODULE: ./packages/swap-sdk/src/entities/nativeCurrency.ts /** * Represents the native currency of the chain on which it resides, e.g. */ var NativeCurrency = /*#__PURE__*/ function(BaseCurrency) { "use strict"; (0,_inherits/* default */.Z)(NativeCurrency, BaseCurrency); var _super = (0,_create_super/* default */.Z)(NativeCurrency); function NativeCurrency() { (0,_class_call_check/* default */.Z)(this, NativeCurrency); var _this; _this = _super.apply(this, arguments); _this.isNative = true; _this.isToken = false; return _this; } return NativeCurrency; }(BaseCurrency); ;// CONCATENATED MODULE: ./packages/swap-sdk/src/entities/native.ts /** * * Native is the main usage of a 'native' currency, i.e. for BSC mainnet and all testnets */ var Native = /*#__PURE__*/ function(NativeCurrency) { "use strict"; (0,_inherits/* default */.Z)(Native, NativeCurrency); var _super = (0,_create_super/* default */.Z)(Native); function Native(param) { var chainId = param.chainId, decimals = param.decimals, name = param.name, symbol = param.symbol; (0,_class_call_check/* default */.Z)(this, Native); return _super.call(this, chainId, decimals, symbol, name); } var _proto = Native.prototype; _proto.equals = function equals(other) { return other.isNative && other.chainId === this.chainId; }; Native.onChain = function onChain(chainId) { if (chainId in this.cache) { return this.cache[chainId]; } invariant(!!NATIVE[chainId], "NATIVE_CURRENCY"); var _chainId = NATIVE[chainId], decimals = _chainId.decimals, name = _chainId.name, symbol = _chainId.symbol; return this.cache[chainId] = new Native({ chainId: chainId, decimals: decimals, symbol: symbol, name: name }); }; (0,_create_class/* default */.Z)(Native, [ { key: "wrapped", get: function get() { var wnative = WNATIVE[this.chainId]; invariant(!!wnative, "WRAPPED"); return wnative; } } ]); return Native; }(NativeCurrency); Native.cache = {}; ;// CONCATENATED MODULE: ./packages/swap-sdk/src/entities/index.ts ;// CONCATENATED MODULE: ./packages/swap-sdk/src/router.ts function toHex(currencyAmount) { return "0x".concat(currencyAmount.quotient.toString(16)); } var ZERO_HEX = "0x0"; /** * Represents the Pancake Router, and has static methods for helping execute trades. */ var Router = /*#__PURE__*/ function() { "use strict"; function Router() { (0,_class_call_check/* default */.Z)(this, Router); } /** * Produces the on-chain method name to call and the hex encoded parameters to pass as arguments for a given trade. * @param trade to produce call parameters for * @param options options for the call parameters */ Router.swapCallParameters = function swapCallParameters(trade, options) { var etherIn = trade.inputAmount.currency.isNative; var etherOut = trade.outputAmount.currency.isNative; // the router does not support both ether in and out invariant(!(etherIn && etherOut), "ETHER_IN_OUT"); invariant(!("ttl" in options) || options.ttl > 0, "TTL"); var to = validateAndParseAddress(options.recipient); var amountIn = toHex(trade.maximumAmountIn(options.allowedSlippage)); var amountOut = toHex(trade.minimumAmountOut(options.allowedSlippage)); var path = trade.route.path.map(function(token) { return token.address; }); var deadline = "ttl" in options ? "0x".concat((Math.floor(new Date().getTime() / 1000) + options.ttl).toString(16)) : "0x".concat(options.deadline.toString(16)); var useFeeOnTransfer = Boolean(options.feeOnTransfer); var methodName; var args; var value; switch(trade.tradeType){ case TradeType.EXACT_INPUT: if (etherIn) { methodName = useFeeOnTransfer ? "swapExactETHForTokensSupportingFeeOnTransferTokens" : "swapExactETHForTokens"; // (uint amountOutMin, address[] calldata path, address to, uint deadline) args = [ amountOut, path, to, deadline ]; value = amountIn; } else if (etherOut) { methodName = useFeeOnTransfer ? "swapExactTokensForETHSupportingFeeOnTransferTokens" : "swapExactTokensForETH"; // (uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) args = [ amountIn, amountOut, path, to, deadline ]; value = ZERO_HEX; } else { methodName = useFeeOnTransfer ? "swapExactTokensForTokensSupportingFeeOnTransferTokens" : "swapExactTokensForTokens"; // (uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) args = [ amountIn, amountOut, path, to, deadline ]; value = ZERO_HEX; } break; case TradeType.EXACT_OUTPUT: invariant(!useFeeOnTransfer, "EXACT_OUT_FOT"); if (etherIn) { methodName = "swapETHForExactTokens"; // (uint amountOut, address[] calldata path, address to, uint deadline) args = [ amountOut, path, to, deadline ]; value = amountIn; } else if (etherOut) { methodName = "swapTokensForExactETH"; // (uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) args = [ amountOut, amountIn, path, to, deadline ]; value = ZERO_HEX; } else { methodName = "swapTokensForExactTokens"; // (uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) args = [ amountOut, amountIn, path, to, deadline ]; value = ZERO_HEX; } break; } return { methodName: methodName, args: args, value: value }; }; return Router; }(); ;// CONCATENATED MODULE: ./packages/swap-sdk/src/index.ts /***/ }), /***/ 48311: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "J": function() { return /* binding */ UIKitProvider; } /* harmony export */ }); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(87379); /* harmony import */ var _contexts_MatchBreakpoints_Provider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(73588); /* harmony import */ var _contexts_ToastsContext_Provider__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(31712); var UIKitProvider = function UIKitProvider(param) { var theme = param.theme, children = param.children; return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(styled_components__WEBPACK_IMPORTED_MODULE_1__/* .ThemeProvider */ .f6, { theme: theme, children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_contexts_MatchBreakpoints_Provider__WEBPACK_IMPORTED_MODULE_2__/* .MatchBreakpointsProvider */ .mh, { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_contexts_ToastsContext_Provider__WEBPACK_IMPORTED_MODULE_3__/* .ToastsProvider */ .d, { children: children }) }) }); }; /***/ }), /***/ 58305: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7297); /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(87379); function _templateObject() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n /* prettier-ignore */\n html, body, div, span, applet, object, iframe,\n h1, h2, h3, h4, h5, h6, p, blockquote, pre,\n a, abbr, acronym, address, big, cite, code,\n del, dfn, em, img, ins, kbd, q, s, samp,\n small, strike, strong, sub, sup, tt, var,\n b, u, i, center,\n dl, dt, dd, ol, ul, li,\n fieldset, form, label, legend,\n table, caption, tbody, tfoot, thead, tr, th, td,\n article, aside, canvas, details, embed, \n figure, figcaption, footer, header, hgroup, \n menu, nav, output, ruby, section, summary,\n time, mark, audio, video {\n margin: 0;\n padding: 0;\n border: 0;\n font-size: 100%;\n vertical-align: baseline;\n }\n /* HTML5 display-role reset for older browsers */\n /* prettier-ignore */\n article, aside, details, figcaption, figure, \n footer, header, hgroup, menu, nav, section {\n display: block;\n }\n body {\n line-height: 1;\n font-size: 16px;\n }\n ol,\n ul {\n list-style: disc;\n list-style-position: inside;\n }\n blockquote,\n q {\n quotes: none;\n }\n blockquote:before,\n blockquote:after,\n q:before,\n q:after {\n content: none;\n }\n table {\n border-collapse: collapse;\n border-spacing: 0;\n }\n a {\n color: inherit;\n text-decoration: none;\n }\n [role=\"button\"] {\n cursor: pointer;\n }\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n * {\n font-family: 'Kanit', sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n }\n\n /* Number */\n input::-webkit-outer-spin-button,\n input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n input[type=number] {\n -moz-appearance: textfield;\n }\n\n /* Scrollbar */\n ::-webkit-scrollbar {\n width: 8px;\n }\n ::-webkit-scrollbar-thumb {\n background: ", "; \n border-radius: 8px;\n }\n ::-webkit-scrollbar-track {\n box-shadow: inset 0 0 5px ", "; \n border-radius: 10px;\n }\n\n /* Slider */ \n input[type=range] {\n -webkit-appearance: none; /* Hides the slider so that custom slider can be made */\n width: 100%; /* Specific width is required for Firefox. */\n background: transparent; /* Otherwise white in Chrome */\n }\n input[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n }\n input[type=range]:focus {\n outline: none; /* Removes the blue border. You should probably do some kind of focus styling for accessibility reasons though. */\n }\n input[type=range]::-ms-track {\n width: 100%;\n cursor: pointer;\n /* Hides the slider so custom styles can be added */\n background: transparent; \n border-color: transparent;\n color: transparent;\n } \n" ]); _templateObject = function _templateObject() { return data; }; return data; } var ResetCSS = (0,styled_components__WEBPACK_IMPORTED_MODULE_1__/* .createGlobalStyle */ .vJ)(_templateObject(), function(param) { var theme = param.theme; return theme.colors.textSubtle; }, function(param) { var theme = param.theme; return theme.colors.input; }); /* harmony default export */ __webpack_exports__["Z"] = (ResetCSS); /***/ }), /***/ 78947: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7297); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(67294); /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(87379); /* harmony import */ var _Svg_Icons_CheckmarkCircle__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(39398); /* harmony import */ var _Svg_Icons_Error__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5389); /* harmony import */ var _Svg_Icons_Block__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(31246); /* harmony import */ var _Svg_Icons_Info__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(95459); /* harmony import */ var _Text__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(62077); /* harmony import */ var _Button__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(89663); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(81641); /* harmony import */ var _Box_Flex__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(75943); /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(46842); function _templateObject() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n background-color: ", ";\n border-radius: 16px 0 0 16px;\n color: ", ";\n padding: 12px;\n" ]); _templateObject = function _templateObject() { return data; }; return data; } function _templateObject1() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n flex: 1;\n padding-bottom: 12px;\n padding-left: 12px;\n padding-right: ", ";\n padding-top: 12px;\n" ]); _templateObject1 = function _templateObject1() { return data; }; return data; } function _templateObject2() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n border-radius: 0 16px 16px 0;\n right: 8px;\n position: absolute;\n top: 8px;\n" ]); _templateObject2 = function _templateObject2() { return data; }; return data; } function _templateObject3() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n position: relative;\n background-color: ", ";\n border-radius: 16px;\n box-shadow: 0px 20px 36px -8px rgba(14, 14, 44, 0.1), 0px 1px 1px rgba(0, 0, 0, 0.05);\n" ]); _templateObject3 = function _templateObject3() { return data; }; return data; } var getThemeColor = function getThemeColor(param) { var theme = param.theme, _variant = param.variant, variant = _variant === void 0 ? _types__WEBPACK_IMPORTED_MODULE_3__/* .variants.INFO */ .o.INFO : _variant; switch(variant){ case _types__WEBPACK_IMPORTED_MODULE_3__/* .variants.DANGER */ .o.DANGER: return theme.colors.failure; case _types__WEBPACK_IMPORTED_MODULE_3__/* .variants.WARNING */ .o.WARNING: return theme.colors.warning; case _types__WEBPACK_IMPORTED_MODULE_3__/* .variants.SUCCESS */ .o.SUCCESS: return theme.colors.success; case _types__WEBPACK_IMPORTED_MODULE_3__/* .variants.INFO */ .o.INFO: default: return theme.colors.secondary; } }; var getIcon = function getIcon() { var variant = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : _types__WEBPACK_IMPORTED_MODULE_3__/* .variants.INFO */ .o.INFO; switch(variant){ case _types__WEBPACK_IMPORTED_MODULE_3__/* .variants.DANGER */ .o.DANGER: return _Svg_Icons_Block__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z; case _types__WEBPACK_IMPORTED_MODULE_3__/* .variants.WARNING */ .o.WARNING: return _Svg_Icons_Error__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z; case _types__WEBPACK_IMPORTED_MODULE_3__/* .variants.SUCCESS */ .o.SUCCESS: return _Svg_Icons_CheckmarkCircle__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z; case _types__WEBPACK_IMPORTED_MODULE_3__/* .variants.INFO */ .o.INFO: default: return _Svg_Icons_Info__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z; } }; var IconLabel = styled_components__WEBPACK_IMPORTED_MODULE_8__/* ["default"].div.withConfig */ .ZP.div.withConfig({ componentId: "sc-c80d62ca-0" }).withConfig({ componentId: "sc-cf5fce8f-0" })(_templateObject(), getThemeColor, function(param) { var theme = param.theme; return theme.alert.background; }); var withHandlerSpacing = 32 + 12 + 8; // button size + inner spacing + handler position var Details = styled_components__WEBPACK_IMPORTED_MODULE_8__/* ["default"].div.withConfig */ .ZP.div.withConfig({ componentId: "sc-c80d62ca-1" }).withConfig({ componentId: "sc-cf5fce8f-1" })(_templateObject1(), function(param) { var hasHandler = param.hasHandler; return hasHandler ? "".concat(withHandlerSpacing, "px") : "12px"; }); var CloseHandler = styled_components__WEBPACK_IMPORTED_MODULE_8__/* ["default"].div.withConfig */ .ZP.div.withConfig({ componentId: "sc-c80d62ca-2" }).withConfig({ componentId: "sc-cf5fce8f-2" })(_templateObject2()); var StyledAlert = (0,styled_components__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .ZP)(_Box_Flex__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z).withConfig({ componentId: "sc-c80d62ca-3" }).withConfig({ componentId: "sc-cf5fce8f-3" })(_templateObject3(), function(param) { var theme = param.theme; return theme.alert.background; }); var Alert = function Alert(param) { var title = param.title, children = param.children, variant = param.variant, onClick = param.onClick; var Icon = getIcon(variant); return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(StyledAlert, { children: [ /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(IconLabel, { variant: variant, hasDescription: !!children, children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(Icon, { color: "currentColor", width: "24px" }) }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(Details, { hasHandler: !!onClick, children: [ /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_Text__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z, { bold: true, children: title }), typeof children === "string" ? /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_Text__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z, { as: "p", children: children }) : children ] }), onClick && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(CloseHandler, { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_Button__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z, { scale: "sm", variant: "text", onClick: onClick, children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_Svg__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .Z, { width: "24px", color: "currentColor" }) }) }) ] }); }; /* harmony default export */ __webpack_exports__["Z"] = (Alert); /***/ }), /***/ 52613: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "R": function() { return /* binding */ light; }, /* harmony export */ "_": function() { return /* binding */ dark; } /* harmony export */ }); /* harmony import */ var _theme_colors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16557); var light = { background: _theme_colors__WEBPACK_IMPORTED_MODULE_0__/* .lightColors.backgroundAlt */ .C.backgroundAlt }; var dark = { background: _theme_colors__WEBPACK_IMPORTED_MODULE_0__/* .darkColors.backgroundAlt */ ._.backgroundAlt }; /***/ }), /***/ 46842: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "o": function() { return /* binding */ variants; } /* harmony export */ }); var variants = { INFO: "info", DANGER: "danger", SUCCESS: "success", WARNING: "warning" }; /***/ }), /***/ 86258: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Q4": function() { return /* binding */ unmountAnimation; }, /* harmony export */ "SE": function() { return /* binding */ mountAnimation; }, /* harmony export */ "qt": function() { return /* binding */ DrawerContainer; } /* harmony export */ }); /* harmony import */ var _swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7297); /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(87379); /* eslint-disable import/prefer-default-export */ function _templateObject() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n 0% {\n transform: translateY(20%);\n }\n 100% {\n transform: translateY(0%);\n }\n " ]); _templateObject = function _templateObject() { return data; }; return data; } function _templateObject1() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n 0% {\n transform: translateY(0%);\n }\n 100% {\n transform: translateY(20%);\n }\n " ]); _templateObject1 = function _templateObject1() { return data; }; return data; } function _templateObject2() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n animation: ", " 350ms ease forwards;\n " ]); _templateObject2 = function _templateObject2() { return data; }; return data; } function _templateObject3() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n width: 100%;\n height: 80vh;\n bottom: 0;\n background-color: ", ";\n border-top-left-radius: 32px;\n border-top-right-radius: 32px;\n position: fixed;\n animation: ", ' 350ms ease forwards;\n padding-bottom: env(safe-area-inset-bottom);\n html[data-useragent*="TokenPocket_iOS"] & {\n padding-bottom: 45px;\n }\n will-change: transform;\n z-index: 21;\n ', "\n" ]); _templateObject3 = function _templateObject3() { return data; }; return data; } var mountAnimation = (0,styled_components__WEBPACK_IMPORTED_MODULE_1__/* .keyframes */ .F4)(_templateObject()); var unmountAnimation = (0,styled_components__WEBPACK_IMPORTED_MODULE_1__/* .keyframes */ .F4)(_templateObject1()); var DrawerContainer = styled_components__WEBPACK_IMPORTED_MODULE_1__/* ["default"].div.withConfig */ .ZP.div.withConfig({ componentId: "sc-a4321cba-0" }).withConfig({ componentId: "sc-501eb54e-0" })(_templateObject3(), function(param) { var theme = param.theme; return theme.colors.backgroundAlt; }, mountAnimation, function(param) { var isUnmounting = param.isUnmounting; return isUnmounting && (0,styled_components__WEBPACK_IMPORTED_MODULE_1__/* .css */ .iv)(_templateObject2(), unmountAnimation); }); /***/ }), /***/ 44147: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "u": function() { return /* binding */ MotionBox; } /* harmony export */ }); /* harmony import */ var _swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7297); /* harmony import */ var framer_motion__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(45962); /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(87379); /* harmony import */ var styled_system__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(57247); function _templateObject() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n ", "\n ", "\n ", "\n ", "\n ", "\n" ]); _templateObject = function _templateObject() { return data; }; return data; } function _templateObject1() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n" ]); _templateObject1 = function _templateObject1() { return data; }; return data; } var MotionBox = (0,styled_components__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .ZP)(framer_motion__WEBPACK_IMPORTED_MODULE_3__.m.div).withConfig({ componentId: "sc-b492d839-0" }).withConfig({ componentId: "sc-de7e8801-0" })(_templateObject(), styled_system__WEBPACK_IMPORTED_MODULE_1__/* .background */ .Oq, styled_system__WEBPACK_IMPORTED_MODULE_1__/* .border */ .Cg, styled_system__WEBPACK_IMPORTED_MODULE_1__/* .layout */ .bK, styled_system__WEBPACK_IMPORTED_MODULE_1__/* .position */ .FK, styled_system__WEBPACK_IMPORTED_MODULE_1__/* .space */ .Dh); var Box = styled_components__WEBPACK_IMPORTED_MODULE_2__/* ["default"].div.withConfig */ .ZP.div.withConfig({ componentId: "sc-b492d839-1" }).withConfig({ componentId: "sc-de7e8801-1" })(_templateObject1(), styled_system__WEBPACK_IMPORTED_MODULE_1__/* .background */ .Oq, styled_system__WEBPACK_IMPORTED_MODULE_1__/* .border */ .Cg, styled_system__WEBPACK_IMPORTED_MODULE_1__/* .layout */ .bK, styled_system__WEBPACK_IMPORTED_MODULE_1__/* .position */ .FK, styled_system__WEBPACK_IMPORTED_MODULE_1__/* .space */ .Dh, styled_system__WEBPACK_IMPORTED_MODULE_1__/* .color */ .$_); /* harmony default export */ __webpack_exports__["Z"] = (Box); /***/ }), /***/ 75943: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7297); /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(87379); /* harmony import */ var styled_system__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(57247); /* harmony import */ var _Box__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(44147); function _templateObject() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n display: flex;\n ", "\n" ]); _templateObject = function _templateObject() { return data; }; return data; } var Flex = (0,styled_components__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .ZP)(_Box__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z).withConfig({ componentId: "sc-32d5f017-0" }).withConfig({ componentId: "sc-1080dffc-0" })(_templateObject(), styled_system__WEBPACK_IMPORTED_MODULE_1__/* .flexbox */ .GQ); /* harmony default export */ __webpack_exports__["Z"] = (Flex); /***/ }), /***/ 66260: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7297); /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(87379); /* harmony import */ var styled_system__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(57247); /* harmony import */ var _Box__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(44147); function _templateObject() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n display: grid;\n ", "\n ", "\n" ]); _templateObject = function _templateObject() { return data; }; return data; } var Grid = (0,styled_components__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .ZP)(_Box__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z).withConfig({ componentId: "sc-b3fe3fbc-0" }).withConfig({ componentId: "sc-9f27ee41-0" })(_templateObject(), styled_system__WEBPACK_IMPORTED_MODULE_1__/* .flexbox */ .GQ, styled_system__WEBPACK_IMPORTED_MODULE_1__/* .grid */ .eC); /* harmony default export */ __webpack_exports__["Z"] = (Grid); /***/ }), /***/ 98553: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { "Z": function() { return /* binding */ Button_Button; } }); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_spread.mjs var _object_spread = __webpack_require__(26042); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_spread_props.mjs var _object_spread_props = __webpack_require__(69396); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_without_properties.mjs + 1 modules var _object_without_properties = __webpack_require__(99534); // EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js var jsx_runtime = __webpack_require__(85893); // EXTERNAL MODULE: ./node_modules/react/index.js var react = __webpack_require__(67294); // EXTERNAL MODULE: ./packages/uikit/src/util/externalLinkProps.ts var externalLinkProps = __webpack_require__(21777); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_tagged_template_literal.mjs var _tagged_template_literal = __webpack_require__(7297); // EXTERNAL MODULE: ./node_modules/styled-components/dist/styled-components.browser.esm.js + 4 modules var styled_components_browser_esm = __webpack_require__(87379); // EXTERNAL MODULE: ./node_modules/styled-system/dist/index.esm.js + 13 modules var index_esm = __webpack_require__(57247); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_define_property.mjs var _define_property = __webpack_require__(14924); // EXTERNAL MODULE: ./packages/uikit/src/components/Button/types.ts var types = __webpack_require__(39793); ;// CONCATENATED MODULE: ./packages/uikit/src/components/Button/theme.ts var _obj; var scaleVariants = (_obj = {}, (0,_define_property/* default */.Z)(_obj, types/* scales.MD */.Q.MD, { height: "48px", padding: "0 24px" }), (0,_define_property/* default */.Z)(_obj, types/* scales.SM */.Q.SM, { height: "32px", padding: "0 16px" }), (0,_define_property/* default */.Z)(_obj, types/* scales.XS */.Q.XS, { height: "20px", fontSize: "12px", padding: "0 8px" }), _obj); var _obj1; var styleVariants = (_obj1 = {}, (0,_define_property/* default */.Z)(_obj1, types/* variants.PRIMARY */.o.PRIMARY, { backgroundColor: "primary", color: "white" }), (0,_define_property/* default */.Z)(_obj1, types/* variants.SECONDARY */.o.SECONDARY, { backgroundColor: "transparent", border: "2px solid", borderColor: "primary", boxShadow: "none", color: "primary", ":disabled": { backgroundColor: "transparent" } }), (0,_define_property/* default */.Z)(_obj1, types/* variants.TERTIARY */.o.TERTIARY, { backgroundColor: "tertiary", boxShadow: "none", color: "primary" }), (0,_define_property/* default */.Z)(_obj1, types/* variants.SUBTLE */.o.SUBTLE, { backgroundColor: "textSubtle", color: "backgroundAlt" }), (0,_define_property/* default */.Z)(_obj1, types/* variants.DANGER */.o.DANGER, { backgroundColor: "failure", color: "white" }), (0,_define_property/* default */.Z)(_obj1, types/* variants.SUCCESS */.o.SUCCESS, { backgroundColor: "success", color: "white" }), (0,_define_property/* default */.Z)(_obj1, types/* variants.TEXT */.o.TEXT, { backgroundColor: "transparent", color: "primary", boxShadow: "none" }), (0,_define_property/* default */.Z)(_obj1, types/* variants.LIGHT */.o.LIGHT, { backgroundColor: "input", color: "textSubtle", boxShadow: "none" }), _obj1); ;// CONCATENATED MODULE: ./packages/uikit/src/components/Button/StyledButton.tsx function _templateObject() { var data = (0,_tagged_template_literal/* default */.Z)([ '\n &::before {\n content: "', '";\n position: absolute;\n border-bottom: 20px solid ', ";\n border-left: 34px solid transparent;\n border-right: 12px solid transparent;\n height: 0;\n top: -1px;\n right: -12px;\n width: 75px;\n text-align: center;\n padding-right: 30px;\n line-height: 20px;\n font-size: 12px;\n font-weight: 400;\n transform: rotate(31.17deg);\n color: ", ";\n }\n " ]); _templateObject = function _templateObject() { return data; }; return data; } function _templateObject1() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n position: relative;\n align-items: center;\n border: 0;\n border-radius: 16px;\n box-shadow: 0px -1px 0px 0px rgba(14, 14, 44, 0.4) inset;\n cursor: pointer;\n display: inline-flex;\n font-family: inherit;\n font-size: 16px;\n font-weight: 600;\n justify-content: center;\n letter-spacing: 0.03em;\n line-height: 1;\n opacity: ", ";\n outline: 0;\n transition: background-color 0.2s, opacity 0.2s;\n\n &:hover:not(:disabled):not(.pancake-button--disabled):not(.pancake-button--disabled):not(:active) {\n opacity: 0.65;\n }\n\n &:active:not(:disabled):not(.pancake-button--disabled):not(.pancake-button--disabled) {\n opacity: 0.85;\n transform: translateY(1px);\n box-shadow: none;\n }\n\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n" ]); _templateObject1 = function _templateObject1() { return data; }; return data; } var getDisabledStyles = function getDisabledStyles(param) { var $isLoading = param.$isLoading, theme = param.theme; if ($isLoading === true) { return "\n &:disabled,\n &.pancake-button--disabled {\n cursor: not-allowed;\n }\n "; } return "\n &:disabled,\n &.pancake-button--disabled {\n background-color: ".concat(theme.colors.backgroundDisabled, ";\n border-color: ").concat(theme.colors.backgroundDisabled, ";\n box-shadow: none;\n color: ").concat(theme.colors.textDisabled, ";\n cursor: not-allowed;\n }\n "); }; /** * This is to get around an issue where if you use a Link component * React will throw a invalid DOM attribute error * @see https://github.com/styled-components/styled-components/issues/135 */ var getOpacity = function getOpacity(param) { var _$isLoading = param.$isLoading, $isLoading = _$isLoading === void 0 ? false : _$isLoading; return $isLoading ? ".5" : "1"; }; var _backgroundColor, _color; var StyledButton = styled_components_browser_esm/* default.button.withConfig */.ZP.button.withConfig({ componentId: "sc-a8cf5f33-0" }).withConfig({ componentId: "sc-ee37452c-0" })(_templateObject1(), getOpacity, getDisabledStyles, (0,index_esm/* variant */.bU)({ prop: "scale", variants: scaleVariants }), (0,index_esm/* variant */.bU)({ variants: styleVariants }), index_esm/* layout */.bK, index_esm/* space */.Dh, function(param) { var decorator = param.decorator, theme = param.theme; return decorator && (0,styled_components_browser_esm/* css */.iv)(_templateObject(), decorator.text, (_backgroundColor = decorator.backgroundColor) !== null && _backgroundColor !== void 0 ? _backgroundColor : theme.colors.secondary, (_color = decorator.color) !== null && _color !== void 0 ? _color : "white"); }); /* harmony default export */ var Button_StyledButton = (StyledButton); ;// CONCATENATED MODULE: ./packages/uikit/src/components/Button/Button.tsx var Button = function Button(props) { var startIcon = props.startIcon, endIcon = props.endIcon, external = props.external, className = props.className, isLoading = props.isLoading, disabled = props.disabled, children = props.children, rest = (0,_object_without_properties/* default */.Z)(props, [ "startIcon", "endIcon", "external", "className", "isLoading", "disabled", "children" ]); var internalProps = external ? externalLinkProps/* default */.Z : {}; var isDisabled = isLoading || disabled; var classNames = className ? [ className ] : []; if (isLoading) { classNames.push("pancake-button--loading"); } if (isDisabled && !isLoading) { classNames.push("pancake-button--disabled"); } return /*#__PURE__*/ (0,jsx_runtime.jsx)(Button_StyledButton, (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({ $isLoading: isLoading, className: classNames.join(" "), disabled: isDisabled }, internalProps, rest), { children: /*#__PURE__*/ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, { children: [ /*#__PURE__*/ (0,react.isValidElement)(startIcon) && /*#__PURE__*/ (0,react.cloneElement)(startIcon, { mr: "0.5rem" }), children, /*#__PURE__*/ (0,react.isValidElement)(endIcon) && /*#__PURE__*/ (0,react.cloneElement)(endIcon, { ml: "0.5rem" }) ] }) })); }; Button.defaultProps = { isLoading: false, external: false, variant: types/* variants.PRIMARY */.o.PRIMARY, scale: types/* scales.MD */.Q.MD, disabled: false }; /* harmony default export */ var Button_Button = (Button); /***/ }), /***/ 89663: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7297); /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(87379); /* harmony import */ var _Button__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(98553); function _templateObject() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n padding: 0;\n width: ", ";\n" ]); _templateObject = function _templateObject() { return data; }; return data; } var IconButton = (0,styled_components__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .ZP)(_Button__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z).withConfig({ componentId: "sc-a97aa614-0" }).withConfig({ componentId: "sc-6498c20f-0" })(_templateObject(), function(param) { var scale = param.scale; return scale === "sm" ? "32px" : "48px"; }); /* harmony default export */ __webpack_exports__["Z"] = (IconButton); /***/ }), /***/ 39793: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Q": function() { return /* binding */ scales; }, /* harmony export */ "o": function() { return /* binding */ variants; } /* harmony export */ }); var scales = { MD: "md", SM: "sm", XS: "xs" }; var variants = { PRIMARY: "primary", SECONDARY: "secondary", TERTIARY: "tertiary", TEXT: "text", DANGER: "danger", SUBTLE: "subtle", SUCCESS: "success", LIGHT: "light" }; /***/ }), /***/ 12587: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(69396); /* harmony import */ var _swc_helpers_src_object_without_properties_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(99534); /* harmony import */ var _swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7297); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(67294); /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(87379); /* harmony import */ var styled_system__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(57247); /* harmony import */ var _Button_types__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(39793); function _templateObject() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n background-color: ", ";\n border-radius: 16px;\n display: ", ";\n border: 1px solid ", ";\n width: ", ";\n\n & > button,\n & > a {\n flex: ", ";\n }\n\n & > button + button,\n & > a + a {\n margin-left: 2px; // To avoid focus shadow overlap\n }\n\n & > button,\n & a {\n box-shadow: none;\n }\n\n ", "\n ", "\n" ]); _templateObject = function _templateObject() { return data; }; return data; } var getBackgroundColor = function getBackgroundColor(param) { var theme = param.theme, variant = param.variant; return theme.colors[variant === _Button_types__WEBPACK_IMPORTED_MODULE_4__/* .variants.SUBTLE */ .o.SUBTLE ? "input" : "tertiary"]; }; var getBorderColor = function getBorderColor(param) { var theme = param.theme, variant = param.variant; return theme.colors[variant === _Button_types__WEBPACK_IMPORTED_MODULE_4__/* .variants.SUBTLE */ .o.SUBTLE ? "inputSecondary" : "disabled"]; }; var StyledButtonMenu = styled_components__WEBPACK_IMPORTED_MODULE_5__/* ["default"].div.withConfig */ .ZP.div.withConfig({ componentId: "sc-15e0dcc-0" }).withConfig({ componentId: "sc-1a15102a-0" })(_templateObject(), getBackgroundColor, function(param) { var fullWidth = param.fullWidth; return fullWidth ? "flex" : "inline-flex"; }, getBorderColor, function(param) { var fullWidth = param.fullWidth; return fullWidth ? "100%" : "auto"; }, function(param) { var fullWidth = param.fullWidth; return fullWidth ? 1 : "auto"; }, function(param) { var disabled = param.disabled, theme = param.theme, variant = param.variant; if (disabled) { return "\n opacity: 0.5;\n\n & > button:disabled {\n background-color: transparent;\n color: ".concat(variant === _Button_types__WEBPACK_IMPORTED_MODULE_4__/* .variants.PRIMARY */ .o.PRIMARY ? theme.colors.primary : theme.colors.textSubtle, ";\n }\n "); } return ""; }, styled_system__WEBPACK_IMPORTED_MODULE_3__/* .space */ .Dh); var ButtonMenu = function ButtonMenu(_param) { var _activeIndex = _param.activeIndex, activeIndex = _activeIndex === void 0 ? 0 : _activeIndex, _scale = _param.scale, scale = _scale === void 0 ? _Button_types__WEBPACK_IMPORTED_MODULE_4__/* .scales.MD */ .Q.MD : _scale, _variant = _param.variant, variant = _variant === void 0 ? _Button_types__WEBPACK_IMPORTED_MODULE_4__/* .variants.PRIMARY */ .o.PRIMARY : _variant, onItemClick = _param.onItemClick, disabled = _param.disabled, children = _param.children, _fullWidth = _param.fullWidth, fullWidth = _fullWidth === void 0 ? false : _fullWidth, props = (0,_swc_helpers_src_object_without_properties_mjs__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z)(_param, [ "activeIndex", "scale", "variant", "onItemClick", "disabled", "children", "fullWidth" ]); return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(StyledButtonMenu, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z)({ disabled: disabled, variant: variant, fullWidth: fullWidth }, props), { children: react__WEBPACK_IMPORTED_MODULE_2__.Children.map(children, function(child, index) { return /*#__PURE__*/ (0,react__WEBPACK_IMPORTED_MODULE_2__.cloneElement)(child, { isActive: activeIndex === index, onClick: onItemClick ? function() { return onItemClick(index); } : undefined, scale: scale, variant: variant, disabled: disabled }); }) })); }; /* harmony default export */ __webpack_exports__["Z"] = (ButtonMenu); /***/ }), /***/ 51983: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_without_properties_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(99534); /* harmony import */ var _swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7297); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(67294); /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(87379); /* harmony import */ var _Button_Button__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(98553); /* harmony import */ var _Button_types__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(39793); function _templateObject() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n background-color: transparent;\n color: ", ";\n &:hover:not(:disabled):not(:active) {\n background-color: transparent;\n }\n" ]); _templateObject = function _templateObject() { return data; }; return data; } var InactiveButton = (0,styled_components__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .ZP)(_Button_Button__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z).withConfig({ componentId: "sc-baf98d6e-0" }).withConfig({ componentId: "sc-42ae4f7c-0" })(_templateObject(), function(param) { var theme = param.theme, variant = param.variant; return variant === _Button_types__WEBPACK_IMPORTED_MODULE_5__/* .variants.PRIMARY */ .o.PRIMARY ? theme.colors.primary : theme.colors.textSubtle; }); var ButtonMenuItem = function ButtonMenuItem(_param) { var _isActive = _param.isActive, isActive = _isActive === void 0 ? false : _isActive, _variant = _param.variant, variant = _variant === void 0 ? _Button_types__WEBPACK_IMPORTED_MODULE_5__/* .variants.PRIMARY */ .o.PRIMARY : _variant, as = _param.as, props = (0,_swc_helpers_src_object_without_properties_mjs__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z)(_param, [ "isActive", "variant", "as" ]); if (!isActive) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(InactiveButton, (0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z)({ forwardedAs: as, variant: variant }, props)); } return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_Button_Button__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z)({ as: as, variant: variant }, props)); }; /* harmony default export */ __webpack_exports__["Z"] = (ButtonMenuItem); /***/ }), /***/ 70802: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7297); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(67294); /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(87379); /* harmony import */ var _Svg_Icons_LogoRound__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(24653); /* harmony import */ var _Text_Text__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(62077); /* harmony import */ var _Skeleton_Skeleton__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(62685); function _templateObject() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n display: flex;\n align-items: center;\n svg {\n transition: transform 0.3s;\n }\n :hover {\n svg {\n transform: scale(1.2);\n }\n }\n" ]); _templateObject = function _templateObject() { return data; }; return data; } var PriceLink = styled_components__WEBPACK_IMPORTED_MODULE_3__/* ["default"].a.withConfig */ .ZP.a.withConfig({ componentId: "sc-777c9bae-0" }).withConfig({ componentId: "sc-4b9a02d3-0" })(_templateObject()); var CakePrice = function CakePrice(param) { var cakePriceUsd = param.cakePriceUsd, _color = param.color, color = _color === void 0 ? "textSubtle" : _color, _showSkeleton = param.showSkeleton, showSkeleton = _showSkeleton === void 0 ? true : _showSkeleton; return cakePriceUsd ? /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(PriceLink, { href: "https://pancakeswap.finance/swap?outputCurrency=0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82&chainId=56", target: "_blank", children: [ /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_Svg_Icons_LogoRound__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, { width: "24px", mr: "8px" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_Text_Text__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, { color: color, bold: true, children: "$".concat(cakePriceUsd.toFixed(3)) }) ] }) : showSkeleton ? /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_Skeleton_Skeleton__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, { width: 80, height: 24 }) : null; }; /* harmony default export */ __webpack_exports__["Z"] = (/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2__.memo(CakePrice)); /***/ }), /***/ 7270: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "R": function() { return /* binding */ light; }, /* harmony export */ "_": function() { return /* binding */ dark; } /* harmony export */ }); /* harmony import */ var _pancakeswap_ui_css_vars_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(41727); /* harmony import */ var _theme_colors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16557); var light = { background: _theme_colors__WEBPACK_IMPORTED_MODULE_1__/* .lightColors.backgroundAlt */ .C.backgroundAlt, boxShadow: _pancakeswap_ui_css_vars_css__WEBPACK_IMPORTED_MODULE_0__/* .vars.shadows.level1 */ .g.shadows.level1, boxShadowActive: _pancakeswap_ui_css_vars_css__WEBPACK_IMPORTED_MODULE_0__/* .vars.shadows.active */ .g.shadows.active, boxShadowSuccess: _pancakeswap_ui_css_vars_css__WEBPACK_IMPORTED_MODULE_0__/* .vars.shadows.success */ .g.shadows.success, boxShadowWarning: _pancakeswap_ui_css_vars_css__WEBPACK_IMPORTED_MODULE_0__/* .vars.shadows.warning */ .g.shadows.warning, cardHeaderBackground: { default: _theme_colors__WEBPACK_IMPORTED_MODULE_1__/* .lightColors.gradientCardHeader */ .C.gradientCardHeader, blue: _theme_colors__WEBPACK_IMPORTED_MODULE_1__/* .lightColors.gradientBlue */ .C.gradientBlue, bubblegum: _theme_colors__WEBPACK_IMPORTED_MODULE_1__/* .lightColors.gradientBubblegum */ .C.gradientBubblegum, violet: _theme_colors__WEBPACK_IMPORTED_MODULE_1__/* .lightColors.gradientViolet */ .C.gradientViolet }, dropShadow: "drop-shadow(0px 1px 4px rgba(25, 19, 38, 0.15))" }; var dark = { background: _theme_colors__WEBPACK_IMPORTED_MODULE_1__/* .darkColors.backgroundAlt */ ._.backgroundAlt, boxShadow: _pancakeswap_ui_css_vars_css__WEBPACK_IMPORTED_MODULE_0__/* .vars.shadows.level1 */ .g.shadows.level1, boxShadowActive: _pancakeswap_ui_css_vars_css__WEBPACK_IMPORTED_MODULE_0__/* .vars.shadows.active */ .g.shadows.active, boxShadowSuccess: _pancakeswap_ui_css_vars_css__WEBPACK_IMPORTED_MODULE_0__/* .vars.shadows.success */ .g.shadows.success, boxShadowWarning: _pancakeswap_ui_css_vars_css__WEBPACK_IMPORTED_MODULE_0__/* .vars.shadows.warning */ .g.shadows.warning, cardHeaderBackground: { default: _theme_colors__WEBPACK_IMPORTED_MODULE_1__/* .darkColors.gradientCardHeader */ ._.gradientCardHeader, blue: _theme_colors__WEBPACK_IMPORTED_MODULE_1__/* .darkColors.gradientBlue */ ._.gradientBlue, bubblegum: _theme_colors__WEBPACK_IMPORTED_MODULE_1__/* .lightColors.gradientBubblegum */ .C.gradientBubblegum, violet: _theme_colors__WEBPACK_IMPORTED_MODULE_1__/* .darkColors.gradientViolet */ ._.gradientViolet }, dropShadow: "drop-shadow(0px 1px 4px rgba(25, 19, 38, 0.15))" }; /***/ }), /***/ 92052: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { "Z": function() { return /* binding */ Checkbox_Checkbox; } }); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_tagged_template_literal.mjs var _tagged_template_literal = __webpack_require__(7297); // EXTERNAL MODULE: ./node_modules/styled-components/dist/styled-components.browser.esm.js + 4 modules var styled_components_browser_esm = __webpack_require__(87379); ;// CONCATENATED MODULE: ./packages/uikit/src/components/Checkbox/types.ts var scales = { SM: "sm", MD: "md" }; ;// CONCATENATED MODULE: ./packages/uikit/src/components/Checkbox/Checkbox.tsx function _templateObject() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n appearance: none;\n overflow: hidden;\n cursor: pointer;\n position: relative;\n display: inline-block;\n height: ", ";\n width: ", ";\n vertical-align: middle;\n transition: background-color 0.2s ease-in-out;\n border: 0;\n border-radius: 8px;\n background-color: ", ";\n box-shadow: ", ';\n\n &:after {\n content: "";\n position: absolute;\n border-bottom: 2px solid;\n border-left: 2px solid;\n border-color: transparent;\n top: 30%;\n left: 0;\n right: 0;\n width: 50%;\n height: 25%;\n margin: auto;\n transform: rotate(-50deg);\n transition: border-color 0.2s ease-in-out;\n }\n\n &:hover:not(:disabled):not(:checked) {\n box-shadow: ', ";\n }\n\n &:focus {\n outline: none;\n box-shadow: ", ";\n }\n\n &:checked {\n background-color: ", ";\n &:after {\n border-color: white;\n }\n }\n\n &:disabled {\n cursor: default;\n opacity: 0.6;\n }\n" ]); _templateObject = function _templateObject() { return data; }; return data; } var getScale = function getScale(param) { var scale = param.scale; switch(scale){ case scales.SM: return "24px"; case scales.MD: default: return "32px"; } }; var Checkbox = styled_components_browser_esm/* default.input.attrs */.ZP.input.attrs({ type: "checkbox" }).withConfig({ componentId: "sc-11bd21f1-0" }).withConfig({ componentId: "sc-d4d20c70-0" })(_templateObject(), getScale, getScale, function(param) { var theme = param.theme; return theme.colors.input; }, function(param) { var theme = param.theme; return theme.shadows.inset; }, function(param) { var theme = param.theme; return theme.shadows.focus; }, function(param) { var theme = param.theme; return theme.shadows.focus; }, function(param) { var theme = param.theme; return theme.colors.success; }); Checkbox.defaultProps = { scale: scales.MD }; /* harmony default export */ var Checkbox_Checkbox = (Checkbox); /***/ }), /***/ 33560: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7297); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(67294); /* harmony import */ var lodash_throttle__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(23493); /* harmony import */ var lodash_throttle__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash_throttle__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(87379); /* harmony import */ var _contexts__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(34701); function _templateObject() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n width: max-content;\n display: flex;\n flex-direction: column;\n position: absolute;\n transform: translate(-50%, 0);\n left: ", ";\n bottom: ", ";\n background-color: ", ";\n box-shadow: ", ";\n padding: 16px;\n max-height: 0px;\n overflow: hidden;\n z-index: ", ";\n border-radius: ", ";\n opacity: 0;\n transition: max-height 0s 0.3s, opacity 0.3s ease-in-out;\n will-change: opacity;\n pointer-events: none;\n" ]); _templateObject = function _templateObject() { return data; }; return data; } function _templateObject1() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n &:hover ", ", &:focus-within ", " {\n opacity: 1;\n max-height: 400px;\n overflow-y: auto;\n transition: max-height 0s 0s, opacity 0.3s ease-in-out;\n pointer-events: auto;\n }\n " ]); _templateObject1 = function _templateObject1() { return data; }; return data; } function _templateObject2() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n position: relative;\n ", "\n" ]); _templateObject2 = function _templateObject2() { return data; }; return data; } var getLeft = function getLeft(param) { var position = param.position; if (position === "top-right") { return "100%"; } return "50%"; }; var getBottom = function getBottom(param) { var position = param.position; if (position === "top" || position === "top-right") { return "100%"; } return "auto"; }; var DropdownContent = styled_components__WEBPACK_IMPORTED_MODULE_4__/* ["default"].div.withConfig */ .ZP.div.withConfig({ componentId: "sc-ee5ec6ea-0" }).withConfig({ componentId: "sc-6a2f4cfb-0" })(_templateObject(), getLeft, getBottom, function(param) { var theme = param.theme; return theme.nav.background; }, function(param) { var theme = param.theme; return theme.shadows.level1; }, function(param) { var theme = param.theme; return theme.zIndices.dropdown; }, function(param) { var theme = param.theme; return theme.radii.small; }); var Container = styled_components__WEBPACK_IMPORTED_MODULE_4__/* ["default"].div.withConfig */ .ZP.div.withConfig({ componentId: "sc-ee5ec6ea-1" }).withConfig({ componentId: "sc-6a2f4cfb-1" })(_templateObject2(), function(param) { var $scrolling = param.$scrolling; return !$scrolling && (0,styled_components__WEBPACK_IMPORTED_MODULE_4__/* .css */ .iv)(_templateObject1(), DropdownContent, DropdownContent); }); var Dropdown = function Dropdown(param) { var target = param.target, _position = param.position, position = _position === void 0 ? "bottom" : _position, children = param.children; var ref = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(false), scrolling = ref[0], setScrolling = ref[1]; var isMobile = (0,_contexts__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z)().isMobile; (0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(function() { if (isMobile) { var scrollEndTimer; var handleScroll = function handleScroll() { if (scrollEndTimer) clearTimeout(scrollEndTimer); setScrolling(true); // @ts-ignore scrollEndTimer = setTimeout(function() { setScrolling(false); }, 300); }; var throttledHandleScroll = lodash_throttle__WEBPACK_IMPORTED_MODULE_3___default()(handleScroll, 200); document.addEventListener("scroll", throttledHandleScroll); return function() { document.removeEventListener("scroll", throttledHandleScroll); }; } return undefined; }, [ isMobile ]); return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(Container, { $scrolling: scrolling, children: [ target, /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(DropdownContent, { position: position, children: children }) ] }); }; Dropdown.defaultProps = { // eslint-disable-next-line react/default-props-match-prop-types position: "bottom" }; /* harmony default export */ __webpack_exports__["Z"] = (Dropdown); /***/ }), /***/ 78242: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "l": function() { return /* binding */ DropdownMenuItemType; } /* harmony export */ }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(67294); var DropdownMenuItemType; (function(DropdownMenuItemType) { DropdownMenuItemType[DropdownMenuItemType["INTERNAL_LINK"] = 0] = "INTERNAL_LINK"; DropdownMenuItemType[DropdownMenuItemType["EXTERNAL_LINK"] = 1] = "EXTERNAL_LINK"; DropdownMenuItemType[DropdownMenuItemType["BUTTON"] = 2] = "BUTTON"; DropdownMenuItemType[DropdownMenuItemType["DIVIDER"] = 3] = "DIVIDER"; })(DropdownMenuItemType || (DropdownMenuItemType = {})); /***/ }), /***/ 69589: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { "Z": function() { return /* binding */ Heading_Heading; } }); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_define_property.mjs var _define_property = __webpack_require__(14924); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_tagged_template_literal.mjs var _tagged_template_literal = __webpack_require__(7297); // EXTERNAL MODULE: ./node_modules/styled-components/dist/styled-components.browser.esm.js + 4 modules var styled_components_browser_esm = __webpack_require__(87379); // EXTERNAL MODULE: ./packages/uikit/src/components/Text/Text.tsx var Text = __webpack_require__(62077); ;// CONCATENATED MODULE: ./packages/uikit/src/components/Heading/types.ts var tags = { H1: "h1", H2: "h2", H3: "h3", H4: "h4", H5: "h5", H6: "h6" }; var scales = { MD: "md", LG: "lg", XL: "xl", XXL: "xxl" }; ;// CONCATENATED MODULE: ./packages/uikit/src/components/Heading/Heading.tsx function _templateObject() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n font-size: ", ";\n font-weight: 600;\n line-height: 1.1;\n\n ", " {\n font-size: ", ";\n }\n" ]); _templateObject = function _templateObject() { return data; }; return data; } var _obj; var style = (_obj = {}, (0,_define_property/* default */.Z)(_obj, scales.MD, { fontSize: "20px", fontSizeLg: "20px" }), (0,_define_property/* default */.Z)(_obj, scales.LG, { fontSize: "24px", fontSizeLg: "24px" }), (0,_define_property/* default */.Z)(_obj, scales.XL, { fontSize: "32px", fontSizeLg: "40px" }), (0,_define_property/* default */.Z)(_obj, scales.XXL, { fontSize: "48px", fontSizeLg: "64px" }), _obj); var Heading = (0,styled_components_browser_esm/* default */.ZP)(Text/* default */.Z).attrs({ bold: true }).withConfig({ componentId: "sc-4eb7e0a9-0" }).withConfig({ componentId: "sc-82ba446f-0" })(_templateObject(), function(param) { var scale = param.scale; return style[scale || scales.MD].fontSize; }, function(param) { var theme = param.theme; return theme.mediaQueries.lg; }, function(param) { var scale = param.scale; return style[scale || scales.MD].fontSizeLg; }); Heading.defaultProps = { as: tags.H2 }; /* harmony default export */ var Heading_Heading = (Heading); /***/ }), /***/ 63970: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(69396); /* harmony import */ var _swc_helpers_src_object_without_properties_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(99534); /* harmony import */ var _swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7297); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(67294); /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(87379); /* harmony import */ var _options__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(26888); /* harmony import */ var _Wrapper__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(25934); /* harmony import */ var _Placeholder__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(46376); function _templateObject() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n height: 100%;\n left: 0;\n position: absolute;\n top: 0;\n width: 100%;\n" ]); _templateObject = function _templateObject() { return data; }; return data; } var StyledImage = styled_components__WEBPACK_IMPORTED_MODULE_3__/* ["default"].img.withConfig */ .ZP.img.withConfig({ componentId: "sc-9e9837e7-0" }).withConfig({ componentId: "sc-a8cc495-0" })(_templateObject()); var Image = function Image(_param) { var src = _param.src, alt = _param.alt, width = _param.width, height = _param.height, fallbackSrc = _param.fallbackSrc, props = (0,_swc_helpers_src_object_without_properties_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)(_param, [ "src", "alt", "width", "height", "fallbackSrc" ]); var imgRef = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(null); var ref = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(false), isLoaded = ref[0], setIsLoaded = ref[1]; var ref1 = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(false), error = ref1[0], setError = ref1[1]; (0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(function() { var observer; var isSupported = true && window.IntersectionObserver; if (imgRef.current && isSupported) { observer = new window.IntersectionObserver(function(entries) { entries.forEach(function(entry) { var isIntersecting = entry.isIntersecting; if (isIntersecting) { setIsLoaded(true); if (typeof (observer === null || observer === void 0 ? void 0 : observer.disconnect) === "function") { observer.disconnect(); } } }); }, _options__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z); observer.observe(imgRef.current); } return function() { if (typeof (observer === null || observer === void 0 ? void 0 : observer.disconnect) === "function") { observer.disconnect(); } }; }, [ src ]); return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_Wrapper__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z)({ ref: imgRef, height: height, width: width }, props), { children: isLoaded ? /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(StyledImage, { src: error && fallbackSrc ? fallbackSrc : src, alt: alt, onError: function onError() { return setError(true); } }) : /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_Placeholder__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z, {}) })); }; /* harmony default export */ __webpack_exports__["Z"] = (Image); /***/ }), /***/ 46376: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7297); /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(87379); function _templateObject() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n height: 100%;\n left: 0;\n position: absolute;\n top: 0;\n width: 100%;\n" ]); _templateObject = function _templateObject() { return data; }; return data; } var Placeholder = styled_components__WEBPACK_IMPORTED_MODULE_1__/* ["default"].div.withConfig */ .ZP.div.withConfig({ componentId: "sc-ba77ab76-0" }).withConfig({ componentId: "sc-77a8b922-0" })(_templateObject()); /* harmony default export */ __webpack_exports__["Z"] = (Placeholder); /***/ }), /***/ 25934: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_without_properties_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(99534); /* harmony import */ var _swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7297); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(67294); /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(87379); /* harmony import */ var styled_system__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(57247); function _templateObject() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n max-height: ", "px;\n max-width: ", 'px;\n position: relative;\n width: 100%;\n\n &:after {\n content: "";\n display: block;\n padding-top: ', "%;\n }\n\n ", "\n" ]); _templateObject = function _templateObject() { return data; }; return data; } var StyledWrapper = styled_components__WEBPACK_IMPORTED_MODULE_4__/* ["default"].div.withConfig */ .ZP.div.withConfig({ componentId: "sc-c1f44966-0" }).withConfig({ componentId: "sc-9687def8-0" })(_templateObject(), function(param) { var $height = param.$height; return $height; }, function(param) { var $width = param.$width; return $width; }, function(param) { var $width = param.$width, $height = param.$height; return $height / $width * 100; }, styled_system__WEBPACK_IMPORTED_MODULE_3__/* .space */ .Dh); var Wrapper = /*#__PURE__*/ (0,react__WEBPACK_IMPORTED_MODULE_2__.forwardRef)(function(_param, ref) { var width = _param.width, height = _param.height, props = (0,_swc_helpers_src_object_without_properties_mjs__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z)(_param, [ "width", "height" ]); return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(StyledWrapper, (0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z)({ ref: ref, $width: width, $height: height }, props)); }); /* harmony default export */ __webpack_exports__["Z"] = (Wrapper); /***/ }), /***/ 26888: /***/ (function(__unused_webpack_module, __webpack_exports__) { "use strict"; /* harmony default export */ __webpack_exports__["Z"] = ({ root: null, rootMargin: "200px", threshold: 0 }); /***/ }), /***/ 32762: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7297); /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(87379); /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6704); function _templateObject() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n background-color: ", ";\n border-radius: 16px;\n box-shadow: ", ";\n color: ", ";\n display: block;\n font-size: 16px;\n height: ", ";\n outline: 0;\n padding: 0 16px;\n width: 100%;\n border: 1px solid ", ";\n\n &::placeholder {\n color: ", ";\n }\n\n &:disabled {\n background-color: ", ";\n box-shadow: none;\n color: ", ";\n cursor: not-allowed;\n }\n\n &:focus:not(:disabled) {\n box-shadow: ", ";\n }\n" ]); _templateObject = function _templateObject() { return data; }; return data; } /** * Priority: Warning --> Success */ var getBoxShadow = function getBoxShadow(param) { var _isSuccess = param.isSuccess, isSuccess = _isSuccess === void 0 ? false : _isSuccess, _isWarning = param.isWarning, isWarning = _isWarning === void 0 ? false : _isWarning, theme = param.theme; if (isWarning) { return theme.shadows.warning; } if (isSuccess) { return theme.shadows.success; } return theme.shadows.inset; }; var getHeight = function getHeight(param) { var _scale = param.scale, scale = _scale === void 0 ? _types__WEBPACK_IMPORTED_MODULE_1__/* .scales.MD */ .Q.MD : _scale; switch(scale){ case _types__WEBPACK_IMPORTED_MODULE_1__/* .scales.SM */ .Q.SM: return "32px"; case _types__WEBPACK_IMPORTED_MODULE_1__/* .scales.LG */ .Q.LG: return "48px"; case _types__WEBPACK_IMPORTED_MODULE_1__/* .scales.MD */ .Q.MD: default: return "40px"; } }; var Input = styled_components__WEBPACK_IMPORTED_MODULE_2__/* ["default"].input.withConfig */ .ZP.input.withConfig({ componentId: "sc-c22a9310-0" }).withConfig({ componentId: "sc-39f22014-0" })(_templateObject(), function(param) { var theme = param.theme; return theme.colors.input; }, getBoxShadow, function(param) { var theme = param.theme; return theme.colors.text; }, getHeight, function(param) { var theme = param.theme; return theme.colors.inputSecondary; }, function(param) { var theme = param.theme; return theme.colors.textSubtle; }, function(param) { var theme = param.theme; return theme.colors.backgroundDisabled; }, function(param) { var theme = param.theme; return theme.colors.textDisabled; }, function(param) { var theme = param.theme, isWarning = param.isWarning, isSuccess = param.isSuccess; if (isWarning) { return theme.shadows.warning; } if (isSuccess) { return theme.shadows.success; } return theme.shadows.focus; }); Input.defaultProps = { scale: _types__WEBPACK_IMPORTED_MODULE_1__/* .scales.MD */ .Q.MD, isSuccess: false, isWarning: false }; /* harmony default export */ __webpack_exports__["Z"] = (Input); /***/ }), /***/ 6704: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Q": function() { return /* binding */ scales; } /* harmony export */ }); var scales = { SM: "sm", MD: "md", LG: "lg" }; /***/ }), /***/ 98768: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_without_properties_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(99534); /* harmony import */ var _swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7297); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(67294); /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(87379); /* harmony import */ var _util_externalLinkProps__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(21777); /* harmony import */ var _Text_Text__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(62077); function _templateObject() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n display: flex;\n align-items: center;\n width: fit-content;\n &:hover {\n text-decoration: underline;\n }\n" ]); _templateObject = function _templateObject() { return data; }; return data; } var StyledLink = (0,styled_components__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .ZP)(_Text_Text__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z).withConfig({ componentId: "sc-2d8b3c99-0" }).withConfig({ componentId: "sc-9ad59b84-0" })(_templateObject()); var Link = function Link(_param) { var external = _param.external, props = (0,_swc_helpers_src_object_without_properties_mjs__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z)(_param, [ "external" ]); var internalProps = external ? _util_externalLinkProps__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z : {}; return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(StyledLink, (0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z)({ as: "a", bold: true }, internalProps, props)); }; /* eslint-disable react/default-props-match-prop-types */ Link.defaultProps = { color: "primary" }; /* harmony default export */ __webpack_exports__["Z"] = (Link); /***/ }), /***/ 40735: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(69396); /* harmony import */ var _swc_helpers_src_object_without_properties_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(99534); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Link__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(98768); /* harmony import */ var _Svg_Icons_OpenNew__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(30793); var LinkExternal = function LinkExternal(_param) { var children = _param.children, props = (0,_swc_helpers_src_object_without_properties_mjs__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)(_param, [ "children" ]); return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_Link__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z)({ external: true }, props), { children: [ children, /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Svg_Icons_OpenNew__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, { color: props.color ? props.color : "primary", ml: "4px" }) ] })); }; /* harmony default export */ __webpack_exports__["Z"] = (LinkExternal); /***/ }), /***/ 29995: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { "Z": function() { return /* binding */ MenuItem_MenuItem; } }); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_spread.mjs var _object_spread = __webpack_require__(26042); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_spread_props.mjs var _object_spread_props = __webpack_require__(69396); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_without_properties.mjs + 1 modules var _object_without_properties = __webpack_require__(99534); // EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js var jsx_runtime = __webpack_require__(85893); // EXTERNAL MODULE: ./node_modules/react/index.js var react = __webpack_require__(67294); // EXTERNAL MODULE: ./packages/uikit/src/widgets/Menu/context.ts var context = __webpack_require__(63524); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_tagged_template_literal.mjs var _tagged_template_literal = __webpack_require__(7297); // EXTERNAL MODULE: ./node_modules/styled-components/dist/styled-components.browser.esm.js + 4 modules var styled_components_browser_esm = __webpack_require__(87379); ;// CONCATENATED MODULE: ./packages/uikit/src/components/MenuItem/styles.tsx function _templateObject() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n position: relative;\n\n ", ";\n" ]); _templateObject = function _templateObject() { return data; }; return data; } function _templateObject1() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n position: relative;\n display: flex;\n align-items: center;\n\n color: ", ";\n font-size: 16px;\n font-weight: ", ";\n opacity: ", ";\n\n ", "\n\n ", "\n\n &:hover {\n background: ", ";\n ", ";\n }\n" ]); _templateObject1 = function _templateObject1() { return data; }; return data; } var StyledMenuItemContainer = styled_components_browser_esm/* default.div.withConfig */.ZP.div.withConfig({ componentId: "sc-ae81c2e-0" }).withConfig({ componentId: "sc-49642412-0" })(_templateObject(), function(param) { var $isActive = param.$isActive, $variant = param.$variant, theme = param.theme; return $isActive && $variant === "subMenu" && '\n &:after{\n content: "";\n position: absolute;\n bottom: 0;\n height: 4px;\n width: 100%;\n background-color: '.concat(theme.colors.primary, ";\n border-radius: 2px 2px 0 0;\n }\n "); }); var StyledMenuItem = styled_components_browser_esm/* default.a.withConfig */.ZP.a.withConfig({ componentId: "sc-ae81c2e-1" }).withConfig({ componentId: "sc-49642412-1" })(_templateObject1(), function(param) { var theme = param.theme, $isActive = param.$isActive; return $isActive ? theme.colors.secondary : theme.colors.textSubtle; }, function(param) { var $isActive = param.$isActive; return $isActive ? "600" : "400"; }, function(param) { var $isDisabled = param.$isDisabled; return $isDisabled ? 0.5 : 1; }, function(param) { var $statusColor = param.$statusColor, theme = param.theme; return $statusColor && '\n &:after {\n content: "";\n border-radius: 100%;\n background: '.concat(theme.colors[$statusColor], ";\n height: 8px;\n width: 8px;\n margin-left: 12px;\n }\n "); }, function(param) { var $variant = param.$variant; return $variant === "default" ? "\n padding: 0 16px;\n height: 48px;\n " : "\n padding: 4px 4px 0px 4px;\n height: 42px;\n "; }, function(param) { var theme = param.theme; return theme.colors.tertiary; }, function(param) { var $variant = param.$variant; return $variant === "default" && "border-radius: 16px;"; }); /* harmony default export */ var styles = (StyledMenuItem); // EXTERNAL MODULE: ./packages/uikit/src/contexts/MatchBreakpoints/useMatchBreakpoints.ts var useMatchBreakpoints = __webpack_require__(34701); ;// CONCATENATED MODULE: ./packages/uikit/src/components/MenuItem/MenuItem.tsx var MenuItem = function MenuItem(_param) { var children = _param.children, href = _param.href, _isActive = _param.isActive, isActive = _isActive === void 0 ? false : _isActive, _isDisabled = _param.isDisabled, isDisabled = _isDisabled === void 0 ? false : _isDisabled, _variant = _param.variant, variant = _variant === void 0 ? "default" : _variant, scrollLayerRef = _param.scrollLayerRef, statusColor = _param.statusColor, props = (0,_object_without_properties/* default */.Z)(_param, [ "children", "href", "isActive", "isDisabled", "variant", "scrollLayerRef", "statusColor" ]); var isMobile = (0,useMatchBreakpoints/* default */.Z)().isMobile; var menuItemRef = (0,react.useRef)(null); var linkComponent = (0,react.useContext)(context/* MenuContext */.p).linkComponent; var itemLinkProps = href ? { as: linkComponent, href: href } : { as: "div" }; (0,react.useEffect)(function() { if (!isMobile || !isActive || !menuItemRef.current || !(scrollLayerRef === null || scrollLayerRef === void 0 ? void 0 : scrollLayerRef.current)) return; var scrollLayer = scrollLayerRef.current; var menuNode = menuItemRef.current.parentNode; if (!menuNode) return; if (scrollLayer.scrollLeft > menuNode.offsetLeft || scrollLayer.scrollLeft + scrollLayer.offsetWidth < menuNode.offsetLeft + menuNode.offsetWidth) { scrollLayer.scrollLeft = menuNode.offsetLeft; } }, [ isActive, isMobile, scrollLayerRef ]); return /*#__PURE__*/ (0,jsx_runtime.jsx)(StyledMenuItemContainer, { $isActive: isActive, $variant: variant, ref: menuItemRef, children: /*#__PURE__*/ (0,jsx_runtime.jsx)(styles, (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)((0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({}, itemLinkProps), { $isActive: isActive, $isDisabled: isDisabled, $variant: variant, $statusColor: statusColor }), props), { children: children })) }); }; /* harmony default export */ var MenuItem_MenuItem = (MenuItem); /***/ }), /***/ 27208: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { "Y": function() { return /* binding */ MessageText; }, "Z": function() { return /* binding */ Message_Message; } }); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_spread.mjs var _object_spread = __webpack_require__(26042); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_spread_props.mjs var _object_spread_props = __webpack_require__(69396); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_without_properties.mjs + 1 modules var _object_without_properties = __webpack_require__(99534); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_tagged_template_literal.mjs var _tagged_template_literal = __webpack_require__(7297); // EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js var jsx_runtime = __webpack_require__(85893); // EXTERNAL MODULE: ./node_modules/react/index.js var react = __webpack_require__(67294); // EXTERNAL MODULE: ./node_modules/styled-components/dist/styled-components.browser.esm.js + 4 modules var styled_components_browser_esm = __webpack_require__(87379); // EXTERNAL MODULE: ./node_modules/styled-system/dist/index.esm.js + 13 modules var index_esm = __webpack_require__(57247); // EXTERNAL MODULE: ./packages/uikit/src/components/Svg/Icons/Warning.tsx var Warning = __webpack_require__(93617); // EXTERNAL MODULE: ./packages/uikit/src/components/Svg/Icons/Error.tsx var Error = __webpack_require__(5389); // EXTERNAL MODULE: ./packages/uikit/src/components/Svg/Icons/CheckmarkCircleFill.tsx var CheckmarkCircleFill = __webpack_require__(95984); // EXTERNAL MODULE: ./packages/uikit/src/components/Text/Text.tsx var Text = __webpack_require__(62077); // EXTERNAL MODULE: ./packages/uikit/src/components/Box/Box.tsx var Box = __webpack_require__(44147); ;// CONCATENATED MODULE: ./packages/uikit/src/components/Message/theme.ts var variants = { warning: { background: "#FFB23719", borderColor: "warning" }, danger: { background: "#ED4B9E19", borderColor: "failure" }, success: { background: "rgba(49, 208, 170, 0.1)", borderColor: "success" } }; /* harmony default export */ var theme = (variants); ;// CONCATENATED MODULE: ./packages/uikit/src/components/Message/Message.tsx function _templateObject() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n background-color: gray;\n padding: 16px;\n border-radius: 16px;\n border: solid 1px;\n\n ", "\n ", "\n" ]); _templateObject = function _templateObject() { return data; }; return data; } function _templateObject1() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n display: flex;\n" ]); _templateObject1 = function _templateObject1() { return data; }; return data; } var MessageContext = /*#__PURE__*/ react.createContext({ variant: "success" }); var Icons = { warning: Warning/* default */.Z, danger: Error/* default */.Z, success: CheckmarkCircleFill/* default */.Z }; var MessageContainer = styled_components_browser_esm/* default.div.withConfig */.ZP.div.withConfig({ componentId: "sc-462695fe-0" }).withConfig({ componentId: "sc-fdd9d09f-0" })(_templateObject(), index_esm/* space */.Dh, (0,index_esm/* variant */.bU)({ variants: theme })); var Flex = styled_components_browser_esm/* default.div.withConfig */.ZP.div.withConfig({ componentId: "sc-462695fe-1" }).withConfig({ componentId: "sc-fdd9d09f-1" })(_templateObject1()); var colors = { // these color names should be place in the theme once the palette is finalized warning: "#D67E0A", success: "#129E7D", danger: "failure" }; var MessageText = function MessageText(_param) { var children = _param.children, props = (0,_object_without_properties/* default */.Z)(_param, [ "children" ]); var ctx = (0,react.useContext)(MessageContext); return /*#__PURE__*/ (0,jsx_runtime.jsx)(Text/* default */.Z, (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({ fontSize: "14px", color: colors[ctx === null || ctx === void 0 ? void 0 : ctx.variant] }, props), { children: children })); }; var Message = function Message(_param) { var children = _param.children, variant = _param.variant, icon = _param.icon, action = _param.action, actionInline = _param.actionInline, props = (0,_object_without_properties/* default */.Z)(_param, [ "children", "variant", "icon", "action", "actionInline" ]); var Icon = Icons[variant]; return /*#__PURE__*/ (0,jsx_runtime.jsx)(MessageContext.Provider, { value: { variant: variant }, children: /*#__PURE__*/ (0,jsx_runtime.jsxs)(MessageContainer, (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({ variant: variant }, props), { children: [ /*#__PURE__*/ (0,jsx_runtime.jsxs)(Flex, { children: [ /*#__PURE__*/ (0,jsx_runtime.jsx)(Box/* default */.Z, { mr: "12px", children: icon !== null && icon !== void 0 ? icon : /*#__PURE__*/ (0,jsx_runtime.jsx)(Icon, { color: theme[variant].borderColor, width: "24px" }) }), children, actionInline && action ] }), !actionInline && action ] })) }); }; /* harmony default export */ var Message_Message = (Message); /***/ }), /***/ 85765: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_without_properties_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(99534); /* harmony import */ var _swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7297); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(67294); /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(87379); function _templateObject() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n display: inline-flex;\n position: relative;\n" ]); _templateObject = function _templateObject() { return data; }; return data; } function _templateObject1() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n display: ", ";\n position: absolute;\n top: 0;\n right: 0;\n width: 10px;\n height: 10px;\n pointer-events: none;\n border: 2px solid ", ";\n border-radius: 50%;\n background-color: ", ";\n" ]); _templateObject1 = function _templateObject1() { return data; }; return data; } var NotificationDotRoot = styled_components__WEBPACK_IMPORTED_MODULE_3__/* ["default"].span.withConfig */ .ZP.span.withConfig({ componentId: "sc-a93f15de-0" }).withConfig({ componentId: "sc-c1ffb375-0" })(_templateObject()); var Dot = styled_components__WEBPACK_IMPORTED_MODULE_3__/* ["default"].span.withConfig */ .ZP.span.withConfig({ componentId: "sc-a93f15de-1" }).withConfig({ componentId: "sc-c1ffb375-1" })(_templateObject1(), function(param) { var show = param.show; return show ? "inline-flex" : "none"; }, function(param) { var theme = param.theme; return theme.colors.invertedContrast; }, function(param) { var theme = param.theme, color = param.color; return theme.colors[color]; }); var NotificationDot = function NotificationDot(_param) /*#__PURE__*/ { var _show = _param.show, show = _show === void 0 ? false : _show, _color = _param.color, color = _color === void 0 ? "failure" : _color, children = _param.children, props = (0,_swc_helpers_src_object_without_properties_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)(_param, [ "show", "color", "children" ]); return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(NotificationDotRoot, { children: [ react__WEBPACK_IMPORTED_MODULE_2__.Children.map(children, function(child) { return /*#__PURE__*/ (0,react__WEBPACK_IMPORTED_MODULE_2__.cloneElement)(child, props); }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(Dot, { show: show, color: color }) ] }); }; /* harmony default export */ __webpack_exports__["Z"] = (NotificationDot); /***/ }), /***/ 72881: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export Overlay */ /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7297); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(85893); /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(87379); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(67294); /* harmony import */ var _Box__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(44147); function _templateObject() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n " ]); _templateObject = function _templateObject() { return data; }; return data; } function _templateObject1() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n " ]); _templateObject1 = function _templateObject1() { return data; }; return data; } function _templateObject2() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n animation: ", " 350ms ease forwards;\n " ]); _templateObject2 = function _templateObject2() { return data; }; return data; } function _templateObject3() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n position: fixed;\n top: 0px;\n left: 0px;\n width: 100%;\n height: 100%;\n background-color: ", ";\n z-index: 20;\n will-change: opacity;\n animation: ", " 350ms ease forwards;\n ", "\n" ]); _templateObject3 = function _templateObject3() { return data; }; return data; } var unmountAnimation = (0,styled_components__WEBPACK_IMPORTED_MODULE_3__/* .keyframes */ .F4)(_templateObject()); var mountAnimation = (0,styled_components__WEBPACK_IMPORTED_MODULE_3__/* .keyframes */ .F4)(_templateObject1()); var StyledOverlay = (0,styled_components__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .ZP)(_Box__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z).withConfig({ componentId: "sc-de82043-0" }).withConfig({ componentId: "sc-f47b4f5d-0" })(_templateObject3(), function(param) { var theme = param.theme; return "".concat(theme.colors.text99); }, mountAnimation, function(param) { var isUnmounting = param.isUnmounting; return isUnmounting && (0,styled_components__WEBPACK_IMPORTED_MODULE_3__/* .css */ .iv)(_templateObject2(), unmountAnimation); }); var BodyLock = function BodyLock() { (0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(function() { document.body.style.cssText = "\n overflow: hidden;\n "; document.body.style.overflow = "hidden"; return function() { document.body.style.cssText = "\n overflow: visible;\n overflow: overlay;\n "; }; }, []); return null; }; var Overlay = function Overlay(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.Fragment, { children: [ /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(BodyLock, {}), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(StyledOverlay, (0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z)({ role: "presentation" }, props)) ] }); }; /* harmony default export */ __webpack_exports__["Z"] = (Overlay); /***/ }), /***/ 25746: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "R": function() { return /* binding */ light; }, /* harmony export */ "_": function() { return /* binding */ dark; } /* harmony export */ }); /* harmony import */ var _theme_colors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16557); var light = { handleBackground: _theme_colors__WEBPACK_IMPORTED_MODULE_0__/* .lightColors.backgroundAlt */ .C.backgroundAlt, handleShadow: _theme_colors__WEBPACK_IMPORTED_MODULE_0__/* .lightColors.textDisabled */ .C.textDisabled }; var dark = { handleBackground: _theme_colors__WEBPACK_IMPORTED_MODULE_0__/* .darkColors.backgroundAlt */ ._.backgroundAlt, handleShadow: _theme_colors__WEBPACK_IMPORTED_MODULE_0__/* .darkColors.textDisabled */ ._.textDisabled }; /***/ }), /***/ 90501: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "R": function() { return /* binding */ light; }, /* harmony export */ "_": function() { return /* binding */ dark; } /* harmony export */ }); /* harmony import */ var _theme_colors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16557); var light = { handleBackground: _theme_colors__WEBPACK_IMPORTED_MODULE_0__/* .lightColors.backgroundAlt */ .C.backgroundAlt }; var dark = { handleBackground: _theme_colors__WEBPACK_IMPORTED_MODULE_0__/* .darkColors.backgroundAlt */ ._.backgroundAlt }; /***/ }), /***/ 62685: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { "i": function() { return /* binding */ SkeletonV2; }, "Z": function() { return /* binding */ Skeleton_Skeleton; } }); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_spread.mjs var _object_spread = __webpack_require__(26042); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_spread_props.mjs var _object_spread_props = __webpack_require__(69396); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_without_properties.mjs + 1 modules var _object_without_properties = __webpack_require__(99534); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_tagged_template_literal.mjs var _tagged_template_literal = __webpack_require__(7297); // EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js var jsx_runtime = __webpack_require__(85893); // EXTERNAL MODULE: ./node_modules/framer-motion/dist/es/render/dom/motion-minimal.mjs + 23 modules var motion_minimal = __webpack_require__(45962); // EXTERNAL MODULE: ./node_modules/framer-motion/dist/es/components/LazyMotion/index.mjs var LazyMotion = __webpack_require__(18522); // EXTERNAL MODULE: ./node_modules/framer-motion/dist/es/render/dom/features-animation.mjs + 27 modules var features_animation = __webpack_require__(55606); // EXTERNAL MODULE: ./node_modules/framer-motion/dist/es/components/AnimatePresence/index.mjs + 3 modules var AnimatePresence = __webpack_require__(21190); // EXTERNAL MODULE: ./node_modules/react/index.js var react = __webpack_require__(67294); // EXTERNAL MODULE: ./node_modules/styled-components/dist/styled-components.browser.esm.js + 4 modules var styled_components_browser_esm = __webpack_require__(87379); // EXTERNAL MODULE: ./node_modules/styled-system/dist/index.esm.js + 13 modules var index_esm = __webpack_require__(57247); ;// CONCATENATED MODULE: ./packages/uikit/src/components/Skeleton/types.ts var types_animation = { WAVES: "waves", PULSE: "pulse" }; var types_variant = { RECT: "rect", CIRCLE: "circle" }; // EXTERNAL MODULE: ./packages/uikit/src/util/animationToolkit.ts var animationToolkit = __webpack_require__(37291); ;// CONCATENATED MODULE: ./packages/uikit/src/components/Skeleton/Skeleton.tsx function _templateObject() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n from {\n left: -150px;\n }\n to {\n left: 100%;\n }\n" ]); _templateObject = function _templateObject() { return data; }; return data; } function _templateObject1() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.4;\n }\n 100% {\n opacity: 1;\n }\n" ]); _templateObject1 = function _templateObject1() { return data; }; return data; } function _templateObject2() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n position: relative;\n will-change: opacity;\n opacity: 0;\n &.appear {\n animation: ", " 0.3s ease-in-out forwards;\n }\n &.disappear {\n animation: ", " 0.3s ease-in-out forwards;\n }\n" ]); _templateObject2 = function _templateObject2() { return data; }; return data; } function _templateObject3() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n position: relative;\n ", "\n ", "\n overflow: hidden;\n" ]); _templateObject3 = function _templateObject3() { return data; }; return data; } function _templateObject4() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n min-height: 20px;\n display: block;\n background-color: ", ";\n border-radius: ", ";\n ", "\n ", "\n ", "\n" ]); _templateObject4 = function _templateObject4() { return data; }; return data; } function _templateObject5() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n animation: ", " 2s infinite ease-out;\n transform: translate3d(0, 0, 0);\n" ]); _templateObject5 = function _templateObject5() { return data; }; return data; } function _templateObject6() { var data = (0,_tagged_template_literal/* default */.Z)([ '\n overflow: hidden;\n transform: translate3d(0, 0, 0);\n &:before {\n content: "";\n position: absolute;\n background-image: linear-gradient(90deg, transparent, rgba(243, 243, 243, 0.5), transparent);\n top: 0;\n left: -150px;\n height: 100%;\n width: 150px;\n animation: ', " 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;\n }\n" ]); _templateObject6 = function _templateObject6() { return data; }; return data; } var waves = (0,styled_components_browser_esm/* keyframes */.F4)(_templateObject()); var pulse = (0,styled_components_browser_esm/* keyframes */.F4)(_templateObject1()); var AnimationWrapper = (0,styled_components_browser_esm/* default */.ZP)(motion_minimal.m.div).withConfig({ componentId: "sc-94de765-0" }).withConfig({ componentId: "sc-bfc8af08-0" })(_templateObject2(), animationToolkit/* appearAnimation */.Oz, animationToolkit/* disappearAnimation */.a4); var SkeletonWrapper = styled_components_browser_esm/* default.div.withConfig */.ZP.div.withConfig({ componentId: "sc-94de765-1" }).withConfig({ componentId: "sc-bfc8af08-1" })(_templateObject3(), index_esm/* layout */.bK, index_esm/* space */.Dh); var Root = styled_components_browser_esm/* default.div.withConfig */.ZP.div.withConfig({ componentId: "sc-94de765-2" }).withConfig({ componentId: "sc-bfc8af08-2" })(_templateObject4(), function(param) { var theme = param.theme; return theme.colors.backgroundDisabled; }, function(param) { var variant = param.variant, theme = param.theme; return variant === types_variant.CIRCLE ? theme.radii.circle : theme.radii.small; }, index_esm/* layout */.bK, index_esm/* space */.Dh, index_esm/* borderRadius */.E0); var Pulse = (0,styled_components_browser_esm/* default */.ZP)(Root).withConfig({ componentId: "sc-94de765-3" }).withConfig({ componentId: "sc-bfc8af08-3" })(_templateObject5(), pulse); var Waves = (0,styled_components_browser_esm/* default */.ZP)(Root).withConfig({ componentId: "sc-94de765-4" }).withConfig({ componentId: "sc-bfc8af08-4" })(_templateObject6(), waves); var Skeleton = function Skeleton(_param) { var _variant = _param.variant, variant = _variant === void 0 ? types_variant.RECT : _variant, _animation = _param.animation, animation = _animation === void 0 ? types_animation.PULSE : _animation, props = (0,_object_without_properties/* default */.Z)(_param, [ "variant", "animation" ]); if (animation === types_animation.WAVES) { return /*#__PURE__*/ (0,jsx_runtime.jsx)(Waves, (0,_object_spread/* default */.Z)({ variant: variant }, props)); } return /*#__PURE__*/ (0,jsx_runtime.jsx)(Pulse, (0,_object_spread/* default */.Z)({ variant: variant }, props)); }; var SkeletonV2 = function SkeletonV2(_param) { var _variant = _param.variant, variant = _variant === void 0 ? types_variant.RECT : _variant, _animation = _param.animation, animation = _animation === void 0 ? types_animation.PULSE : _animation, _isDataReady = _param.isDataReady, isDataReady = _isDataReady === void 0 ? false : _isDataReady, children = _param.children, wrapperProps = _param.wrapperProps, _skeletonTop = _param.skeletonTop, skeletonTop = _skeletonTop === void 0 ? "0" : _skeletonTop, _skeletonLeft = _param.skeletonLeft, skeletonLeft = _skeletonLeft === void 0 ? "0" : _skeletonLeft, width = _param.width, height = _param.height, mr = _param.mr, ml = _param.ml, props = (0,_object_without_properties/* default */.Z)(_param, [ "variant", "animation", "isDataReady", "children", "wrapperProps", "skeletonTop", "skeletonLeft", "width", "height", "mr", "ml" ]); var animationRef = (0,react.useRef)(null); var skeletonRef = (0,react.useRef)(null); return /*#__PURE__*/ (0,jsx_runtime.jsx)(SkeletonWrapper, (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({ width: width, height: height, mr: mr, ml: ml }, wrapperProps), { children: /*#__PURE__*/ (0,jsx_runtime.jsx)(LazyMotion/* LazyMotion */.X, { features: features_animation/* domAnimation */.H, children: /*#__PURE__*/ (0,jsx_runtime.jsxs)(AnimatePresence/* AnimatePresence */.M, { children: [ isDataReady && /*#__PURE__*/ (0,jsx_runtime.jsx)(AnimationWrapper, (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({ ref: animationRef, onAnimationStart: function onAnimationStart() { return (0,animationToolkit/* animationHandler */.BI)(animationRef.current); } }, animationToolkit/* animationMap */.Gc), { variants: animationToolkit/* animationVariants */.ji, transition: { duration: 0.3 }, children: children }), "content"), !isDataReady && /*#__PURE__*/ (0,jsx_runtime.jsx)(AnimationWrapper, (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({ style: { position: "absolute", top: skeletonTop, left: skeletonLeft }, ref: skeletonRef, onAnimationStart: function onAnimationStart() { return (0,animationToolkit/* animationHandler */.BI)(skeletonRef.current); } }, animationToolkit/* animationMap */.Gc), { variants: animationToolkit/* animationVariants */.ji, transition: { duration: 0.3 }, children: animation === types_animation.WAVES ? /*#__PURE__*/ (0,jsx_runtime.jsx)(Waves, (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({ variant: variant }, props), { width: width, height: height })) : /*#__PURE__*/ (0,jsx_runtime.jsx)(Pulse, (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({ variant: variant }, props), { width: width, height: height })) }), "skeleton") ] }) }) })); }; /* harmony default export */ var Skeleton_Skeleton = (Skeleton); /***/ }), /***/ 46852: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { "Z": function() { return /* binding */ SubMenuItems_SubMenuItems; } }); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_spread.mjs var _object_spread = __webpack_require__(26042); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_spread_props.mjs var _object_spread_props = __webpack_require__(69396); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_without_properties.mjs + 1 modules var _object_without_properties = __webpack_require__(99534); // EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js var jsx_runtime = __webpack_require__(85893); // EXTERNAL MODULE: ./node_modules/lodash/debounce.js var debounce = __webpack_require__(23279); var debounce_default = /*#__PURE__*/__webpack_require__.n(debounce); // EXTERNAL MODULE: ./node_modules/react/index.js var react = __webpack_require__(67294); // EXTERNAL MODULE: ./packages/uikit/src/contexts/MatchBreakpoints/useMatchBreakpoints.ts var useMatchBreakpoints = __webpack_require__(34701); // EXTERNAL MODULE: ./packages/uikit/src/components/Box/Box.tsx var Box = __webpack_require__(44147); // EXTERNAL MODULE: ./packages/uikit/src/components/DropdownMenu/types.ts var types = __webpack_require__(78242); // EXTERNAL MODULE: ./packages/uikit/src/components/MenuItem/MenuItem.tsx + 1 modules var MenuItem = __webpack_require__(29995); // EXTERNAL MODULE: ./packages/uikit/src/components/Svg/Icons/ChevronLeft.tsx var ChevronLeft = __webpack_require__(91080); // EXTERNAL MODULE: ./packages/uikit/src/components/Svg/Icons/ChevronRight.tsx var ChevronRight = __webpack_require__(37303); // EXTERNAL MODULE: ./packages/uikit/src/components/Svg/Icons/OpenNew.tsx var OpenNew = __webpack_require__(30793); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_tagged_template_literal.mjs var _tagged_template_literal = __webpack_require__(7297); // EXTERNAL MODULE: ./node_modules/styled-components/dist/styled-components.browser.esm.js + 4 modules var styled_components_browser_esm = __webpack_require__(87379); // EXTERNAL MODULE: ./packages/uikit/src/components/Box/Flex.tsx var Flex = __webpack_require__(75943); ;// CONCATENATED MODULE: ./packages/uikit/src/components/SubMenuItems/styles.tsx function _templateObject() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n ", " {\n ", ";\n }\n width: 100%;\n overflow: hidden;\n position: relative;\n" ]); _templateObject = function _templateObject() { return data; }; return data; } function _templateObject1() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n position: relative;\n z-index: 1;\n width: 100%;\n display: block;\n white-space: nowrap;\n scroll-behavior: smooth;\n ", " {\n width: auto;\n display: flex;\n }\n flex-grow: 1;\n background-color: ", ";\n box-shadow: inset 0px -2px 0px -8px rgba(133, 133, 133, 0.1);\n overflow-x: scroll;\n scrollbar-width: none;\n -ms-overflow-style: none;\n &::-webkit-scrollbar {\n display: none;\n }\n" ]); _templateObject1 = function _templateObject1() { return data; }; return data; } function _templateObject2() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n position: absolute;\n z-index: 2;\n width: 48px;\n height: 100%;\n top: 0px;\n display: flex;\n justify-content: center;\n opacity: 1;\n will-change: opacity;\n transition: 0.25s ease-in opacity;\n &.hide {\n pointer-events: none;\n opacity: 0;\n transition: 0.25s ease-out opacity;\n }\n" ]); _templateObject2 = function _templateObject2() { return data; }; return data; } function _templateObject3() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n ", "\n left: 0px;\n background: ", ";\n" ]); _templateObject3 = function _templateObject3() { return data; }; return data; } function _templateObject4() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n ", "\n right: 0px;\n background: ", ";\n" ]); _templateObject4 = function _templateObject4() { return data; }; return data; } function _templateObject5() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n display: inline-block;\n vertical-align: top;\n scroll-snap-align: start;\n" ]); _templateObject5 = function _templateObject5() { return data; }; return data; } var SubMenuItemWrapper = (0,styled_components_browser_esm/* default */.ZP)(Flex/* default */.Z).withConfig({ componentId: "sc-22a2e93a-0" }).withConfig({ componentId: "sc-f5e821f2-0" })(_templateObject(), function(param) { var theme = param.theme; return theme.mediaQueries.sm; }, function(param) { var $isMobileOnly = param.$isMobileOnly; return $isMobileOnly ? "display:none" : ""; }); var StyledSubMenuItems = (0,styled_components_browser_esm/* default */.ZP)(Flex/* default */.Z).withConfig({ componentId: "sc-22a2e93a-1" }).withConfig({ componentId: "sc-f5e821f2-1" })(_templateObject1(), function(param) { var theme = param.theme; return theme.mediaQueries.md; }, function(param) { var theme = param.theme; return "".concat(theme.colors.backgroundAlt2); }); var maskSharedStyle = (0,styled_components_browser_esm/* css */.iv)(_templateObject2()); var LeftMaskLayer = styled_components_browser_esm/* default.div.withConfig */.ZP.div.withConfig({ componentId: "sc-22a2e93a-2" }).withConfig({ componentId: "sc-f5e821f2-2" })(_templateObject3(), maskSharedStyle, function(param) { var theme = param.theme; return theme.isDark ? "linear-gradient(90deg, #27262c 29.76%, rgba(39,38,44, 0) 100%)" : "linear-gradient(90deg, #ffffff 29.76%, rgba(255, 255, 255, 0) 100%)"; }); var RightMaskLayer = styled_components_browser_esm/* default.div.withConfig */.ZP.div.withConfig({ componentId: "sc-22a2e93a-3" }).withConfig({ componentId: "sc-f5e821f2-3" })(_templateObject4(), maskSharedStyle, function(param) { var theme = param.theme; return theme.isDark ? "linear-gradient(270deg, #27262c 0%, rgba(39,38,44, 0) 87.5%)" : "linear-gradient(270deg, #ffffff 0%, rgba(255, 255, 255, 0) 87.5%)"; }); var StyledSubMenuItemWrapper = (0,styled_components_browser_esm/* default */.ZP)(Box/* default */.Z).withConfig({ componentId: "sc-22a2e93a-4" }).withConfig({ componentId: "sc-f5e821f2-4" })(_templateObject5()); /* harmony default export */ var styles = (StyledSubMenuItems); ;// CONCATENATED MODULE: ./packages/uikit/src/components/SubMenuItems/SubMenuItems.tsx var SUBMENU_CHEVRON_CLICK_MOVE_PX = 100; var SUBMENU_SCROLL_DEVIATION = 3; var SubMenuItems = function SubMenuItems(_param) { var _items = _param.items, items = _items === void 0 ? [] : _items, activeItem = _param.activeItem, _isMobileOnly = _param.isMobileOnly, isMobileOnly = _isMobileOnly === void 0 ? false : _isMobileOnly, props = (0,_object_without_properties/* default */.Z)(_param, [ "items", "activeItem", "isMobileOnly" ]); var isMobile = (0,useMatchBreakpoints/* default */.Z)().isMobile; var scrollLayerRef = (0,react.useRef)(null); var chevronLeftRef = (0,react.useRef)(null); var chevronRightRef = (0,react.useRef)(null); var layerController = (0,react.useCallback)(function() { if (!scrollLayerRef.current || !chevronLeftRef.current || !chevronRightRef.current) return; var scrollLayer = scrollLayerRef.current; if (scrollLayer.scrollLeft === 0) chevronLeftRef.current.classList.add("hide"); else chevronLeftRef.current.classList.remove("hide"); if (scrollLayer.scrollLeft + scrollLayer.offsetWidth < scrollLayer.scrollWidth - SUBMENU_SCROLL_DEVIATION) chevronRightRef.current.classList.remove("hide"); else chevronRightRef.current.classList.add("hide"); }, []); (0,react.useEffect)(function() { layerController(); }, [ layerController ]); return /*#__PURE__*/ (0,jsx_runtime.jsxs)(SubMenuItemWrapper, (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({ $isMobileOnly: isMobileOnly }, props), { children: [ isMobile && /*#__PURE__*/ (0,jsx_runtime.jsx)(LeftMaskLayer, { ref: chevronLeftRef, onClick: function onClick() { if (!scrollLayerRef.current) return; scrollLayerRef.current.scrollLeft -= SUBMENU_CHEVRON_CLICK_MOVE_PX; }, children: /*#__PURE__*/ (0,jsx_runtime.jsx)(ChevronLeft/* default */.Z, {}) }), isMobile && /*#__PURE__*/ (0,jsx_runtime.jsx)(RightMaskLayer, { ref: chevronRightRef, onClick: function onClick() { if (!scrollLayerRef.current) return; scrollLayerRef.current.scrollLeft += SUBMENU_CHEVRON_CLICK_MOVE_PX; }, children: /*#__PURE__*/ (0,jsx_runtime.jsx)(ChevronRight/* default */.Z, {}) }), /*#__PURE__*/ (0,jsx_runtime.jsx)(styles, { justifyContent: [ isMobileOnly ? "flex-end" : "start", null, "center" ], pl: [ "12px", null, "0px" ], onScroll: debounce_default()(layerController, 100), ref: scrollLayerRef, children: items.map(function(param) { var label = param.label, href = param.href, icon = param.icon, itemProps = param.itemProps, type = param.type, disabled = param.disabled; var Icon = icon; var isExternalLink = type === types/* DropdownMenuItemType.EXTERNAL_LINK */.l.EXTERNAL_LINK; var linkProps = isExternalLink ? { as: "a", target: "_blank" } : {}; var isActive = href === activeItem; return label && /*#__PURE__*/ (0,jsx_runtime.jsx)(StyledSubMenuItemWrapper, { mr: "20px", children: /*#__PURE__*/ (0,jsx_runtime.jsxs)(MenuItem/* default */.Z, (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({ href: href, scrollLayerRef: scrollLayerRef, isActive: isActive, isDisabled: disabled, variant: "subMenu" }, itemProps, linkProps), { children: [ Icon && /*#__PURE__*/ (0,jsx_runtime.jsx)(Icon, { color: isActive ? "secondary" : "textSubtle", mr: "4px" }), label, isExternalLink && /*#__PURE__*/ (0,jsx_runtime.jsx)(Box/* default */.Z, { display: [ "none", null, "flex" ], style: { alignItems: "center" }, ml: "4px", children: /*#__PURE__*/ (0,jsx_runtime.jsx)(OpenNew/* default */.Z, { color: "textSubtle" }) }) ] })) }, label); }) }) ] })); }; /* harmony default export */ var SubMenuItems_SubMenuItems = (SubMenuItems); /***/ }), /***/ 87844: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 24 24" }, props), { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M19 11H7.82998L12.71 6.12C13.1 5.73 13.1 5.09 12.71 4.7C12.32 4.31 11.69 4.31 11.3 4.7L4.70998 11.29C4.31998 11.68 4.31998 12.31 4.70998 12.7L11.3 19.29C11.69 19.68 12.32 19.68 12.71 19.29C13.1 18.9 13.1 18.27 12.71 17.88L7.82998 13H19C19.55 13 20 12.55 20 12C20 11.45 19.55 11 19 11Z" }) })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 45203: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 24 24" }, props), { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M11 5V16.17L6.11997 11.29C5.72997 10.9 5.08997 10.9 4.69997 11.29C4.30997 11.68 4.30997 12.31 4.69997 12.7L11.29 19.29C11.68 19.68 12.31 19.68 12.7 19.29L19.29 12.7C19.68 12.31 19.68 11.68 19.29 11.29C18.9 10.9 18.27 10.9 17.88 11.29L13 16.17V5C13 4.45 12.55 4 12 4C11.45 4 11 4.45 11 5Z" }) })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 18029: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 24 24" }, props), { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M5 13H16.17L11.29 17.88C10.9 18.27 10.9 18.91 11.29 19.3C11.68 19.69 12.31 19.69 12.7 19.3L19.29 12.71C19.68 12.32 19.68 11.69 19.29 11.3L12.71 4.7C12.32 4.31 11.69 4.31 11.3 4.7C10.91 5.09 10.91 5.72 11.3 6.11L16.17 11H5C4.45 11 4 11.45 4 12C4 12.55 4.45 13 5 13Z" }) })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 40696: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 24 24" }, props), { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M13 19V7.83001L17.88 12.71C18.27 13.1 18.91 13.1 19.3 12.71C19.69 12.32 19.69 11.69 19.3 11.3L12.71 4.71001C12.32 4.32001 11.69 4.32001 11.3 4.71001L4.69997 11.29C4.30997 11.68 4.30997 12.31 4.69997 12.7C5.08997 13.09 5.71997 13.09 6.10997 12.7L11 7.83001V19C11 19.55 11.45 20 12 20C12.55 20 13 19.55 13 19Z" }) })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 63771: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 24 24" }, props), { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M12 6V7.79C12 8.24 12.54 8.46 12.85 8.14L15.64 5.35C15.84 5.15 15.84 4.84 15.64 4.64L12.85 1.85C12.54 1.54 12 1.76 12 2.21V4C7.58 4 4 7.58 4 12C4 13.04 4.2 14.04 4.57 14.95C4.84 15.62 5.7 15.8 6.21 15.29C6.48 15.02 6.59 14.61 6.44 14.25C6.15 13.56 6 12.79 6 12C6 8.69 8.69 6 12 6ZM17.79 8.71C17.52 8.98 17.41 9.4 17.56 9.75C17.84 10.45 18 11.21 18 12C18 15.31 15.31 18 12 18V16.21C12 15.76 11.46 15.54 11.15 15.86L8.36 18.65C8.16 18.85 8.16 19.16 8.36 19.36L11.15 22.15C11.46 22.46 12 22.24 12 21.8V20C16.42 20 20 16.42 20 12C20 10.96 19.8 9.96 19.43 9.05C19.16 8.38 18.3 8.2 17.79 8.71Z" }) })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 31246: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 24 24" }, props), { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22ZM12 4C16.42 4 20 7.58 20 12C20 13.85 19.37 15.55 18.31 16.9L7.1 5.69C8.45 4.63 10.15 4 12 4ZM5.69 7.1L16.9 18.31C15.55 19.37 13.85 20 12 20C7.58 20 4 16.42 4 12C4 10.15 4.63 8.45 5.69 7.1Z" }) })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 39398: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 24 24" }, props), { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM12 20C7.59 20 4 16.41 4 12C4 7.59 7.59 4 12 4C16.41 4 20 7.59 20 12C20 16.41 16.41 20 12 20ZM15.88 8.29L10 14.17L8.12 12.29C7.73 11.9 7.1 11.9 6.71 12.29C6.32 12.68 6.32 13.31 6.71 13.7L9.3 16.29C9.69 16.68 10.32 16.68 10.71 16.29L17.3 9.7C17.69 9.31 17.69 8.68 17.3 8.29C16.91 7.9 16.27 7.9 15.88 8.29Z" }) })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 95984: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 24 24" }, props), { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M12 2.75711C6.48 2.75711 2 7.23711 2 12.7571C2 18.2771 6.48 22.7571 12 22.7571C17.52 22.7571 22 18.2771 22 12.7571C22 7.23711 17.52 2.75711 12 2.75711ZM9.29 17.0471L5.7 13.4571C5.31 13.0671 5.31 12.4371 5.7 12.0471C6.09 11.6571 6.72 11.6571 7.11 12.0471L10 14.9271L16.88 8.04711C17.27 7.65711 17.9 7.65711 18.29 8.04711C18.68 8.43711 18.68 9.06711 18.29 9.45711L10.7 17.0471C10.32 17.4371 9.68 17.4371 9.29 17.0471Z" }) })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 57049: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 24 24" }, props), { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M8.11997 9.29006L12 13.1701L15.88 9.29006C16.27 8.90006 16.9 8.90006 17.29 9.29006C17.68 9.68006 17.68 10.3101 17.29 10.7001L12.7 15.2901C12.31 15.6801 11.68 15.6801 11.29 15.2901L6.69997 10.7001C6.30997 10.3101 6.30997 9.68006 6.69997 9.29006C7.08997 8.91006 7.72997 8.90006 8.11997 9.29006Z" }) })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 91080: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 24 24" }, props), { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M14.71 15.88L10.83 12L14.71 8.12001C15.1 7.73001 15.1 7.10001 14.71 6.71001C14.32 6.32001 13.69 6.32001 13.3 6.71001L8.70998 11.3C8.31998 11.69 8.31998 12.32 8.70998 12.71L13.3 17.3C13.69 17.69 14.32 17.69 14.71 17.3C15.09 16.91 15.1 16.27 14.71 15.88Z" }) })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 37303: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 24 24" }, props), { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M9.29006 15.88L13.1701 12L9.29006 8.12001C8.90006 7.73001 8.90006 7.10001 9.29006 6.71001C9.68006 6.32001 10.3101 6.32001 10.7001 6.71001L15.2901 11.3C15.6801 11.69 15.6801 12.32 15.2901 12.71L10.7001 17.3C10.3101 17.69 9.68006 17.69 9.29006 17.3C8.91006 16.91 8.90006 16.27 9.29006 15.88Z" }) })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 81641: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 24 24" }, props), { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { fill: "currentColor", d: "M18.3 5.70997C17.91 5.31997 17.28 5.31997 16.89 5.70997L12 10.59L7.10997 5.69997C6.71997 5.30997 6.08997 5.30997 5.69997 5.69997C5.30997 6.08997 5.30997 6.71997 5.69997 7.10997L10.59 12L5.69997 16.89C5.30997 17.28 5.30997 17.91 5.69997 18.3C6.08997 18.69 6.71997 18.69 7.10997 18.3L12 13.41L16.89 18.3C17.28 18.69 17.91 18.69 18.3 18.3C18.69 17.91 18.69 17.28 18.3 16.89L13.41 12L18.3 7.10997C18.68 6.72997 18.68 6.08997 18.3 5.70997Z" }) })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 79605: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 24 24" }, props), { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M19.43 12.98C19.47 12.66 19.5 12.34 19.5 12C19.5 11.66 19.47 11.34 19.43 11.02L21.54 9.37C21.73 9.22 21.78 8.95 21.66 8.73L19.66 5.27C19.54 5.05 19.27 4.97 19.05 5.05L16.56 6.05C16.04 5.65 15.48 5.32 14.87 5.07L14.49 2.42C14.46 2.18 14.25 2 14 2H9.99996C9.74996 2 9.53996 2.18 9.50996 2.42L9.12996 5.07C8.51996 5.32 7.95996 5.66 7.43996 6.05L4.94996 5.05C4.71996 4.96 4.45996 5.05 4.33996 5.27L2.33996 8.73C2.20996 8.95 2.26996 9.22 2.45996 9.37L4.56996 11.02C4.52996 11.34 4.49996 11.67 4.49996 12C4.49996 12.33 4.52996 12.66 4.56996 12.98L2.45996 14.63C2.26996 14.78 2.21996 15.05 2.33996 15.27L4.33996 18.73C4.45996 18.95 4.72996 19.03 4.94996 18.95L7.43996 17.95C7.95996 18.35 8.51996 18.68 9.12996 18.93L9.50996 21.58C9.53996 21.82 9.74996 22 9.99996 22H14C14.25 22 14.46 21.82 14.49 21.58L14.87 18.93C15.48 18.68 16.04 18.34 16.56 17.95L19.05 18.95C19.28 19.04 19.54 18.95 19.66 18.73L21.66 15.27C21.78 15.05 21.73 14.78 21.54 14.63L19.43 12.98ZM12 15.5C10.07 15.5 8.49996 13.93 8.49996 12C8.49996 10.07 10.07 8.5 12 8.5C13.93 8.5 15.5 10.07 15.5 12C15.5 13.93 13.93 15.5 12 15.5Z" }) })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 57876: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 24 24" }, props), { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M15 1H4C2.9 1 2 1.9 2 3V16C2 16.55 2.45 17 3 17C3.55 17 4 16.55 4 16V4C4 3.45 4.45 3 5 3H15C15.55 3 16 2.55 16 2C16 1.45 15.55 1 15 1ZM19 5H8C6.9 5 6 5.9 6 7V21C6 22.1 6.9 23 8 23H19C20.1 23 21 22.1 21 21V7C21 5.9 20.1 5 19 5ZM18 21H9C8.45 21 8 20.55 8 20V8C8 7.45 8.45 7 9 7H18C18.55 7 19 7.45 19 8V20C19 20.55 18.55 21 18 21Z" }) })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 1611: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 600 600" }, props), { children: [ /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("circle", { cx: "300", cy: "300", r: "300", fill: "white" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M115 191.731L300 85L485 191.731V405.192L300 511.923L115 405.192V191.731ZM226.964 177.278H372.665L390.09 251.396H209.91L226.964 177.278ZM264.037 350.715L268.857 304.391L252.915 262.885H347.083L331.512 304.391L335.961 350.715H299.628H264.037ZM373.036 428.54H346.713L315.2 399.634V384.81L347.825 353.68V304.391L390.461 276.597L439.028 313.285L373.036 428.54ZM254.028 428.91L285.541 399.633V384.81L252.916 353.68V304.391L209.91 276.967L160.972 313.285L227.334 428.91H254.028Z", fill: "#03316C" }) ] })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 8221: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 20 16" }, props), { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M16.93 1.644A16.491 16.491 0 0012.86.38a.062.062 0 00-.066.031c-.175.313-.37.72-.506 1.041a15.226 15.226 0 00-4.573 0A10.54 10.54 0 007.2.412a.064.064 0 00-.065-.031 16.447 16.447 0 00-4.07 1.263.058.058 0 00-.028.023C.444 5.54-.266 9.319.083 13.05a.069.069 0 00.026.047 16.584 16.584 0 004.994 2.525.064.064 0 00.07-.023c.385-.526.728-1.08 1.022-1.662a.063.063 0 00-.035-.088 10.917 10.917 0 01-1.56-.744.064.064 0 01-.007-.106c.105-.079.21-.16.31-.243a.062.062 0 01.065-.009c3.273 1.495 6.817 1.495 10.051 0a.062.062 0 01.066.008c.1.083.204.165.31.244a.064.064 0 01-.005.106c-.499.291-1.017.537-1.561.743a.064.064 0 00-.034.089c.3.582.643 1.135 1.02 1.66a.063.063 0 00.07.025 16.53 16.53 0 005.003-2.525.064.064 0 00.026-.046c.417-4.314-.699-8.061-2.957-11.384a.05.05 0 00-.026-.023zM6.684 10.778c-.985 0-1.797-.905-1.797-2.016 0-1.11.796-2.015 1.797-2.015 1.01 0 1.814.912 1.798 2.015 0 1.111-.796 2.016-1.798 2.016zm6.646 0c-.986 0-1.797-.905-1.797-2.016 0-1.11.796-2.015 1.797-2.015 1.009 0 1.813.912 1.797 2.015 0 1.111-.788 2.016-1.797 2.016z" }) })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 51959: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 24 24" }, props), { children: [ /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M11.4063 19.9329C12.066 19.9329 12.6742 19.779 13.207 19.5106V21.6632C12.6449 21.8378 12.0415 21.9329 11.4063 21.9329H7.00792C2.52538 21.9329 -0.374267 17.1964 1.66429 13.2043L3.70684 9.20426C4.30576 8.03138 5.25922 7.11243 6.39803 6.55101L5.46396 4.68288C5.08785 3.93066 5.54693 3.02913 6.3765 2.89087L11.6153 2.01773C12.5647 1.8595 13.3292 2.78847 12.9912 3.68962L11.9333 6.51092C13.1087 7.06815 14.094 8.00302 14.7074 9.20426L16.6114 12.9329H14.3657L12.9261 10.1138C12.2427 8.77534 10.8666 7.93292 9.36372 7.93292H9.05047C7.54759 7.93292 6.17153 8.77534 5.48805 10.1138L3.4455 14.1138C2.08646 16.7753 4.01956 19.9329 7.00792 19.9329H11.4063ZM10.6623 4.20415L7.70695 4.69671L8.32504 5.93291H10.014L10.6623 4.20415Z" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M14.707 13.9329C14.4309 13.9329 14.207 14.1568 14.207 14.4329V15.4329C14.207 15.7091 14.4309 15.9329 14.707 15.9329H20.707C20.9832 15.9329 21.207 15.7091 21.207 15.4329V14.4329C21.207 14.1568 20.9832 13.9329 20.707 13.9329H14.707Z" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M15.207 17.4329C15.207 17.1568 15.4309 16.9329 15.707 16.9329H21.707C21.9832 16.9329 22.207 17.1568 22.207 17.4329V18.4329C22.207 18.7091 21.9832 18.9329 21.707 18.9329H15.707C15.4309 18.9329 15.207 18.7091 15.207 18.4329V17.4329Z" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M14.707 19.9329C14.4309 19.9329 14.207 20.1568 14.207 20.4329V21.4329C14.207 21.7091 14.4309 21.9329 14.707 21.9329L20.707 21.9329C20.9832 21.9329 21.207 21.7091 21.207 21.4329V20.4329C21.207 20.1568 20.9832 19.9329 20.707 19.9329L14.707 19.9329Z" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M9.9212 9.93292C9.9212 9.51871 9.58541 9.18292 9.1712 9.18292C8.75699 9.18292 8.4212 9.51871 8.4212 9.93292V10.2471C7.4372 10.4874 6.70692 11.3749 6.70692 12.4329C6.70692 13.6756 7.71427 14.6829 8.95691 14.6829H9.64423C10.0043 14.6829 10.3136 14.9388 10.381 15.2926C10.469 15.7548 10.1147 16.1829 9.64423 16.1829H8.89883C8.62969 16.1829 8.38118 16.0387 8.24765 15.805L8.1081 15.5608C7.90259 15.2012 7.44445 15.0762 7.08481 15.2817C6.72517 15.4872 6.60023 15.9454 6.80573 16.305L6.94528 16.5492C7.26526 17.1092 7.80531 17.4979 8.4212 17.6317V17.9329C8.4212 18.3471 8.75699 18.6829 9.1712 18.6829C9.58541 18.6829 9.9212 18.3471 9.9212 17.9329V17.6662C11.1913 17.5114 12.101 16.3061 11.8545 15.0119C11.6524 13.9507 10.7245 13.1829 9.64423 13.1829H8.95691C8.5427 13.1829 8.20692 12.8471 8.20692 12.4329C8.20692 12.0187 8.5427 11.6829 8.95691 11.6829H9.44357C9.71272 11.6829 9.96123 11.8271 10.0948 12.0608L10.2343 12.305C10.4398 12.6647 10.898 12.7896 11.2576 12.5841C11.6172 12.3786 11.7422 11.9205 11.5367 11.5608L11.3971 11.3166C11.0771 10.7566 10.5371 10.3679 9.9212 10.2341V9.93292Z" }) ] })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 41655: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 22 20" }, props), { children: [ /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M12.207 17.836a1 1 0 011-1v-2a1 1 0 01-1-1v-2a1 1 0 011-1h2.404l-1.904-3.728a6 6 0 00-3.234-2.889l1.05-2.801a.75.75 0 00-.825-1.004l-5.24.874a.75.75 0 00-.547 1.075l.945 1.889a6 6 0 00-3.15 2.856l-2.042 4c-2.038 3.992.861 8.728 5.344 8.728h4.398c.635 0 1.239-.095 1.801-.27v-1.73zM8.171 7.086a.75.75 0 01.75.75v.302a2.25 2.25 0 011.476 1.082l.14.244a.75.75 0 11-1.303.745l-.14-.245a.75.75 0 00-.65-.378h-.487a.75.75 0 100 1.5h.687a2.25 2.25 0 01.277 4.484v.266a.75.75 0 01-1.5 0v-.3a2.25 2.25 0 01-1.476-1.083l-.14-.244a.75.75 0 011.303-.745l.14.245a.75.75 0 00.65.377h.746a.75.75 0 100-1.5h-.687a2.25 2.25 0 01-.536-4.435v-.315a.75.75 0 01.75-.75z" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M14.707 14.836a.5.5 0 00-.5.5v1a.5.5 0 00.5.5h6a.5.5 0 00.5-.5v-1a.5.5 0 00-.5-.5h-6zM13.707 11.836a.5.5 0 00-.5.5v1a.5.5 0 00.5.5h6a.5.5 0 00.5-.5v-1a.5.5 0 00-.5-.5h-6zM13.707 17.836a.5.5 0 00-.5.5v1a.5.5 0 00.5.5h6a.5.5 0 00.5-.5v-1a.5.5 0 00-.5-.5h-6z" }) ] })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 5389: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 24 24" }, props), { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M12 7C12.55 7 13 7.45 13 8V12C13 12.55 12.55 13 12 13C11.45 13 11 12.55 11 12V8C11 7.45 11.45 7 12 7ZM11.99 2C6.47 2 2 6.48 2 12C2 17.52 6.47 22 11.99 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 11.99 2ZM12 20C7.58 20 4 16.42 4 12C4 7.58 7.58 4 12 4C16.42 4 20 7.58 20 12C20 16.42 16.42 20 12 20ZM13 17H11V15H13V17Z" }) })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 95160: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 24 24" }, props), { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM12 20C7.59 20 4 16.41 4 12C4 7.59 7.59 4 12 4C16.41 4 20 7.59 20 12C20 16.41 16.41 20 12 20ZM11 16H13V18H11V16ZM12.61 6.04C10.55 5.74 8.73 7.01 8.18 8.83C8 9.41 8.44 10 9.05 10H9.25C9.66 10 9.99 9.71 10.13 9.33C10.45 8.44 11.4 7.83 12.43 8.05C13.38 8.25 14.08 9.18 14 10.15C13.9 11.49 12.38 11.78 11.55 13.03C11.55 13.04 11.54 13.04 11.54 13.05C11.53 13.07 11.52 13.08 11.51 13.1C11.42 13.25 11.33 13.42 11.26 13.6C11.25 13.63 11.23 13.65 11.22 13.68C11.21 13.7 11.21 13.72 11.2 13.75C11.08 14.09 11 14.5 11 15H13C13 14.58 13.11 14.23 13.28 13.93C13.3 13.9 13.31 13.87 13.33 13.84C13.41 13.7 13.51 13.57 13.61 13.45C13.62 13.44 13.63 13.42 13.64 13.41C13.74 13.29 13.85 13.18 13.97 13.07C14.93 12.16 16.23 11.42 15.96 9.51C15.72 7.77 14.35 6.3 12.61 6.04Z" }) })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 95459: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 24 24" }, props), { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M11 7H13V9H11V7ZM12 17C12.55 17 13 16.55 13 16V12C13 11.45 12.55 11 12 11C11.45 11 11 11.45 11 12V16C11 16.55 11.45 17 12 17ZM12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM12 20C7.59 20 4 16.41 4 12C4 7.59 7.59 4 12 4C16.41 4 20 7.59 20 12C20 16.41 16.41 20 12 20Z" }) })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 15446: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 24 24" }, props), { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M11.99 2C6.47 2 2 6.48 2 12C2 17.52 6.47 22 11.99 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 11.99 2ZM18.92 8H15.97C15.65 6.75 15.19 5.55 14.59 4.44C16.43 5.07 17.96 6.35 18.92 8ZM12 4.04C12.83 5.24 13.48 6.57 13.91 8H10.09C10.52 6.57 11.17 5.24 12 4.04ZM4.26 14C4.1 13.36 4 12.69 4 12C4 11.31 4.1 10.64 4.26 10H7.64C7.56 10.66 7.5 11.32 7.5 12C7.5 12.68 7.56 13.34 7.64 14H4.26ZM5.08 16H8.03C8.35 17.25 8.81 18.45 9.41 19.56C7.57 18.93 6.04 17.66 5.08 16ZM8.03 8H5.08C6.04 6.34 7.57 5.07 9.41 4.44C8.81 5.55 8.35 6.75 8.03 8ZM12 19.96C11.17 18.76 10.52 17.43 10.09 16H13.91C13.48 17.43 12.83 18.76 12 19.96ZM14.34 14H9.66C9.57 13.34 9.5 12.68 9.5 12C9.5 11.32 9.57 10.65 9.66 10H14.34C14.43 10.65 14.5 11.32 14.5 12C14.5 12.68 14.43 13.34 14.34 14ZM14.59 19.56C15.19 18.45 15.65 17.25 15.97 16H18.92C17.96 17.65 16.43 18.93 14.59 19.56ZM16.36 14C16.44 13.34 16.5 12.68 16.5 12C16.5 11.32 16.44 10.66 16.36 10H19.74C19.9 10.64 20 11.31 20 12C20 12.69 19.9 13.36 19.74 14H16.36Z" }) })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 24653: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 96 96" }, props), { children: [ /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("circle", { cx: 48, cy: 48, r: 48, fill: "url(#paint0_linear_10493)" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M47.858 79.875c-9.342-.007-16.866-2.249-22.124-6.275-5.321-4.075-8.144-9.857-8.144-16.4 0-6.304 2.817-10.85 6.004-13.923 2.497-2.408 5.253-3.95 7.172-4.838a99.818 99.818 0 01-1.46-4.876c-.648-2.41-1.284-5.237-1.284-7.309 0-2.452.535-4.915 1.977-6.829 1.523-2.021 3.816-3.104 6.574-3.104 2.156 0 3.986.8 5.42 2.179 1.369 1.318 2.28 3.07 2.91 4.895 1.106 3.208 1.537 7.238 1.657 11.26h2.643c.12-4.022.551-8.052 1.657-11.26.63-1.825 1.541-3.577 2.91-4.895 1.434-1.38 3.264-2.18 5.42-2.18 2.758 0 5.051 1.084 6.574 3.105 1.442 1.914 1.977 4.377 1.977 6.83 0 2.071-.636 4.898-1.284 7.308a99.707 99.707 0 01-1.46 4.876c1.919.888 4.675 2.43 7.172 4.838 3.187 3.073 6.004 7.619 6.004 13.923 0 6.543-2.823 12.325-8.144 16.4-5.257 4.026-12.782 6.268-22.124 6.275h-.047z", fill: "#633001" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M36.573 18.653c-4.04 0-5.9 3.045-5.9 7.256 0 3.347 2.16 10.05 3.048 12.66.199.587-.114 1.23-.686 1.458-3.238 1.29-12.794 6.012-12.794 16.828 0 11.393 9.711 19.983 27.619 19.997h.043c17.908-.014 27.619-8.604 27.619-19.997 0-10.816-9.556-15.539-12.794-16.828a1.176 1.176 0 01-.686-1.458c.887-2.61 3.048-9.313 3.048-12.66 0-4.211-1.86-7.256-5.9-7.256-5.816 0-7.266 8.322-7.37 17.254a1.084 1.084 0 01-1.074 1.08h-5.73c-.59 0-1.067-.484-1.074-1.08-.103-8.932-1.553-17.254-7.369-17.254z", fill: "#D1884F" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M47.903 73.202c-13.158 0-27.64-7.115-27.662-16.326v.043c0 11.403 9.727 19.997 27.662 19.997s27.661-8.594 27.661-19.997v-.043c-.022 9.21-14.503 16.326-27.661 16.326z", fill: "#FEDC90" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M40.592 54.047c0 3.11-1.455 4.73-3.25 4.73-1.794 0-3.249-1.62-3.249-4.73 0-3.11 1.455-4.73 3.25-4.73 1.794 0 3.249 1.62 3.249 4.73zM61.712 54.047c0 3.11-1.455 4.73-3.25 4.73-1.794 0-3.248-1.62-3.248-4.73 0-3.11 1.454-4.73 3.249-4.73 1.794 0 3.25 1.62 3.25 4.73z", fill: "#633001" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("defs", { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("linearGradient", { id: "paint0_linear_10493", x1: 48, y1: 0, x2: 48, y2: 96, gradientUnits: "userSpaceOnUse", children: [ /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("stop", { stopColor: "#53DEE9" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("stop", { offset: 1, stopColor: "#1FC7D4" }) ] }) }) ] })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 55036: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 24 24" }, props), { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M16.3 8.09014C15.91 8.48014 15.91 9.10014 16.3 9.49014L18.2 11.3901H9C8.45 11.3901 8 11.8401 8 12.3901C8 12.9401 8.45 13.3901 9 13.3901H18.2L16.3 15.2901C15.91 15.6801 15.91 16.3001 16.3 16.6901C16.69 17.0801 17.31 17.0801 17.7 16.6901L21.29 13.1001C21.68 12.7101 21.68 12.0801 21.29 11.6901L17.7 8.09014C17.31 7.70014 16.69 7.70014 16.3 8.09014ZM4 19.3901H11C11.55 19.3901 12 19.8401 12 20.3901C12 20.9401 11.55 21.3901 11 21.3901H4C2.9 21.3901 2 20.4901 2 19.3901V5.39014C2 4.29014 2.9 3.39014 4 3.39014H11C11.55 3.39014 12 3.84014 12 4.39014C12 4.94014 11.55 5.39014 11 5.39014H4V19.3901Z" }) })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 75545: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 40 40" }, props), { children: [ /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M36.0112 3.33337L22.1207 13.6277L24.7012 7.56091L36.0112 3.33337Z", fill: "#E17726" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M4.00261 3.33337L17.7558 13.7238L15.2989 7.56091L4.00261 3.33337Z", fill: "#E27625" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M31.0149 27.2023L27.3227 32.8573L35.2287 35.0397L37.4797 27.3258L31.0149 27.2023Z", fill: "#E27625" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M2.53386 27.3258L4.77116 35.0397L12.6772 32.8573L8.9987 27.2023L2.53386 27.3258Z", fill: "#E27625" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M12.2518 17.6496L10.0419 20.9712L17.8793 21.3281L17.6048 12.8867L12.2518 17.6496Z", fill: "#E27625" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M27.762 17.6494L22.3129 12.7905L22.1207 21.3279L29.9581 20.9711L27.762 17.6494Z", fill: "#E27625" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M12.6772 32.8574L17.3989 30.5652L13.336 27.3809L12.6772 32.8574Z", fill: "#E27625" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M22.6009 30.5652L27.3226 32.8574L26.6637 27.3809L22.6009 30.5652Z", fill: "#E27625" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M27.3226 32.8575L22.6009 30.5653L22.9715 33.6399L22.9303 34.9301L27.3226 32.8575Z", fill: "#D5BFB2" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M12.6772 32.8575L17.0694 34.9301L17.042 33.6399L17.3989 30.5653L12.6772 32.8575Z", fill: "#D5BFB2" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M17.1518 25.3495L13.2262 24.1965L15.9988 22.92L17.1518 25.3495Z", fill: "#233447" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M22.848 25.3495L24.001 22.92L26.801 24.1965L22.848 25.3495Z", fill: "#233447" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M12.6773 32.8573L13.3635 27.2023L8.99876 27.3258L12.6773 32.8573Z", fill: "#CC6228" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M26.6364 27.2023L27.3227 32.8573L31.0149 27.3258L26.6364 27.2023Z", fill: "#CC6228" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M29.9581 20.9709L22.1207 21.3278L22.8482 25.3495L24.0011 22.92L26.8012 24.1965L29.9581 20.9709Z", fill: "#CC6228" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M13.2263 24.1965L15.9989 22.92L17.1519 25.3495L17.8793 21.3278L10.0419 20.9709L13.2263 24.1965Z", fill: "#CC6228" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M10.0419 20.9709L13.3361 27.3809L13.2263 24.1965L10.0419 20.9709Z", fill: "#E27525" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M26.8011 24.1965L26.6638 27.3809L29.958 20.9709L26.8011 24.1965Z", fill: "#E27525" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M17.8793 21.3278L17.1519 25.3494L18.0715 30.0985L18.2637 23.8396L17.8793 21.3278Z", fill: "#E27525" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M22.1205 21.3278L21.7499 23.8258L21.9283 30.0985L22.848 25.3494L22.1205 21.3278Z", fill: "#E27525" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M22.848 25.3496L21.9284 30.0987L22.601 30.5654L26.6638 27.381L26.8011 24.1967L22.848 25.3496Z", fill: "#F5841F" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M13.2262 24.1967L13.336 27.381L17.3989 30.5654L18.0714 30.0987L17.1518 25.3496L13.2262 24.1967Z", fill: "#F5841F" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M22.9303 34.93L22.9715 33.6398L22.6284 33.3378H17.3714L17.042 33.6398L17.0694 34.93L12.6772 32.8574L14.2145 34.1202L17.3302 36.2751H22.6696L25.7853 34.1202L27.3226 32.8574L22.9303 34.93Z", fill: "#C0AC9D" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M22.601 30.5653L21.9284 30.0986H18.0715L17.3989 30.5653L17.0421 33.6399L17.3715 33.3379H22.6285L22.9716 33.6399L22.601 30.5653Z", fill: "#161616" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M36.5875 14.3003L37.7542 8.61779L36.011 3.33337L22.6009 13.2846L27.7618 17.6493L35.0365 19.7768L36.6424 17.8964L35.9424 17.3886L37.0679 16.3728L36.2169 15.7003L37.3287 14.863L36.5875 14.3003Z", fill: "#763E1A" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M2.24573 8.61779L3.42615 14.3003L2.67123 14.863L3.78302 15.7003L2.93202 16.3728L4.05753 17.3886L3.35752 17.8964L4.96343 19.7768L12.2518 17.6493L17.399 13.2846L4.00263 3.33337L2.24573 8.61779Z", fill: "#763E1A" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M35.0365 19.777L27.7619 17.6495L29.958 20.9712L26.6638 27.3811L31.0149 27.3262H37.4797L35.0365 19.777Z", fill: "#F5841F" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M12.2517 17.6495L4.96332 19.777L2.53386 27.3262H8.99869L13.336 27.3811L10.0419 20.9712L12.2517 17.6495Z", fill: "#F5841F" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M22.1205 21.3276L22.6009 13.2843L24.701 7.56067H15.2988L17.3988 13.2843L17.8792 21.3276L18.0577 23.8531L18.0714 30.0984H21.9283L21.9421 23.8531L22.1205 21.3276Z", fill: "#F5841F" }) ] })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 624: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 24 24" }, props), { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M4.1534 13.6089L4.15362 13.61C4.77322 16.8113 7.42207 19.3677 10.647 19.8853L10.6502 19.8858C13.0412 20.2736 15.2625 19.6103 16.9422 18.2833C11.3549 16.2878 7.9748 10.3524 9.26266 4.48816C5.69846 5.77194 3.35817 9.51245 4.1534 13.6089ZM10.0083 2.21054C4.76622 3.2533 1.09895 8.36947 2.19006 13.9901C2.97006 18.0201 6.28006 21.2101 10.3301 21.8601C13.8512 22.4311 17.0955 21.1608 19.2662 18.8587C19.2765 18.8478 19.2866 18.837 19.2968 18.8261C19.4385 18.6745 19.5757 18.5184 19.7079 18.3581C19.7105 18.355 19.713 18.3519 19.7156 18.3487C19.8853 18.1426 20.0469 17.9295 20.2001 17.7101C20.4101 17.4001 20.2401 16.9601 19.8701 16.9201C19.5114 16.8796 19.1602 16.8209 18.817 16.7452C18.7964 16.7406 18.7758 16.736 18.7552 16.7313C18.6676 16.7114 18.5804 16.6903 18.4938 16.6681C18.4919 16.6676 18.4901 16.6672 18.4882 16.6667C13.0234 15.2647 9.72516 9.48006 11.4542 4.03417C11.4549 4.03214 11.4555 4.03012 11.4562 4.0281C11.4875 3.92954 11.5205 3.83109 11.5552 3.73278C11.5565 3.72911 11.5578 3.72543 11.5591 3.72175C11.6768 3.38921 11.8136 3.05829 11.9701 2.73005C12.1301 2.39005 11.8501 2.01005 11.4701 2.03005C11.1954 2.04379 10.924 2.06848 10.6561 2.10368C10.6517 2.10427 10.6472 2.10486 10.6428 2.10545C10.4413 2.13221 10.2418 2.16492 10.0446 2.2034C10.0325 2.20576 10.0204 2.20814 10.0083 2.21054Z" }) })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 50081: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 24 24" }, props), { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M6 10C4.9 10 4 10.9 4 12C4 13.1 4.9 14 6 14C7.1 14 8 13.1 8 12C8 10.9 7.1 10 6 10ZM18 10C16.9 10 16 10.9 16 12C16 13.1 16.9 14 18 14C19.1 14 20 13.1 20 12C20 10.9 19.1 10 18 10ZM12 10C10.9 10 10 10.9 10 12C10 13.1 10.9 14 12 14C13.1 14 14 13.1 14 12C14 10.9 13.1 10 12 10Z" }) })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 84815: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 24 24" }, props), { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M6 10C4.9 10 4 10.9 4 12C4 13.1 4.9 14 6 14C7.1 14 8 13.1 8 12C8 10.9 7.1 10 6 10ZM18 10C16.9 10 16 10.9 16 12C16 13.1 16.9 14 18 14C19.1 14 20 13.1 20 12C20 10.9 19.1 10 18 10ZM12 10C10.9 10 10 10.9 10 12C10 13.1 10.9 14 12 14C13.1 14 14 13.1 14 12C14 10.9 13.1 10 12 10Z" }) })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 30793: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 24 24" }, props), { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M18 19H6C5.45 19 5 18.55 5 18V6C5 5.45 5.45 5 6 5H11C11.55 5 12 4.55 12 4C12 3.45 11.55 3 11 3H5C3.89 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V13C21 12.45 20.55 12 20 12C19.45 12 19 12.45 19 13V18C19 18.55 18.55 19 18 19ZM14 4C14 4.55 14.45 5 15 5H17.59L8.46 14.13C8.07 14.52 8.07 15.15 8.46 15.54C8.85 15.93 9.48 15.93 9.87 15.54L19 6.41V9C19 9.55 19.45 10 20 10C20.55 10 21 9.55 21 9V4C21 3.45 20.55 3 20 3H15C14.45 3 14 3.45 14 4Z" }) })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 39054: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 24 24" }, props), { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M17.65 6.35C16.02 4.72 13.71 3.78 11.17 4.04C7.50002 4.41 4.48002 7.39 4.07002 11.06C3.52002 15.91 7.27002 20 12 20C15.19 20 17.93 18.13 19.21 15.44C19.53 14.77 19.05 14 18.31 14C17.94 14 17.59 14.2 17.43 14.53C16.3 16.96 13.59 18.5 10.63 17.84C8.41002 17.35 6.62002 15.54 6.15002 13.32C5.31002 9.44 8.26002 6 12 6C13.66 6 15.14 6.69 16.22 7.78L14.71 9.29C14.08 9.92 14.52 11 15.41 11H19C19.55 11 20 10.55 20 10V6.41C20 5.52 18.92 5.07 18.29 5.7L17.65 6.35Z" }) })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 19685: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 24 24" }, props), { children: [ /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M5.66 4.2L6.05 4.59C6.44 4.97 6.44 5.61 6.05 5.99L6.04 6C5.65 6.39 5.03 6.39 4.64 6L4.25 5.61C3.86 5.23 3.86 4.6 4.25 4.21L4.26 4.2C4.64 3.82 5.27 3.81 5.66 4.2Z" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M1.99 10.95H3.01C3.56 10.95 4 11.39 4 11.95V11.96C4 12.51 3.56 12.95 3 12.94H1.99C1.44 12.94 1 12.5 1 11.95V11.94C1 11.39 1.44 10.95 1.99 10.95Z" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M12 1H12.01C12.56 1 13 1.44 13 1.99V2.96C13 3.51 12.56 3.95 12 3.94H11.99C11.44 3.94 11 3.5 11 2.95V1.99C11 1.44 11.44 1 12 1Z" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M18.34 4.2C18.73 3.82 19.36 3.82 19.75 4.21C20.14 4.6 20.14 5.22 19.75 5.61L19.36 6C18.98 6.39 18.35 6.39 17.96 6L17.95 5.99C17.56 5.61 17.56 4.98 17.95 4.59L18.34 4.2Z" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M18.33 19.7L17.94 19.31C17.55 18.92 17.55 18.3 17.95 17.9C18.33 17.52 18.96 17.51 19.35 17.9L19.74 18.29C20.13 18.68 20.13 19.31 19.74 19.7C19.35 20.09 18.72 20.09 18.33 19.7Z" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M20 11.95V11.94C20 11.39 20.44 10.95 20.99 10.95H22C22.55 10.95 22.99 11.39 22.99 11.94V11.95C22.99 12.5 22.55 12.94 22 12.94H20.99C20.44 12.94 20 12.5 20 11.95Z" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M6 11.95C6 8.64 8.69 5.95 12 5.95C15.31 5.95 18 8.64 18 11.95C18 15.26 15.31 17.95 12 17.95C8.69 17.95 6 15.26 6 11.95ZM12 16C14.2091 16 16 14.2091 16 12C16 9.79086 14.2091 8 12 8C9.79086 8 8 9.79086 8 12C8 14.2091 9.79086 16 12 16Z" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M12 22.9H11.99C11.44 22.9 11 22.46 11 21.91V20.95C11 20.4 11.44 19.96 11.99 19.96H12C12.55 19.96 12.99 20.4 12.99 20.95V21.91C12.99 22.46 12.55 22.9 12 22.9Z" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M5.66 19.69C5.27 20.08 4.64 20.08 4.25 19.69C3.86 19.3 3.86 18.68 4.24 18.28L4.63 17.89C5.02 17.5 5.65 17.5 6.04 17.89L6.05 17.9C6.43 18.28 6.44 18.91 6.05 19.3L5.66 19.69Z" }) ] })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 47811: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 24 24" }, props), { children: [ /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M21.2628 15.8306C21.5556 16.1235 21.5556 16.5983 21.2628 16.8912L18.654 19.5H20.3789C20.7931 19.5 21.1289 19.8358 21.1289 20.25C21.1289 20.6642 20.7931 21 20.3789 21L16.8433 21C16.4291 21 16.0933 20.6642 16.0933 20.25V16.7145C16.0933 16.3002 16.4291 15.9645 16.8433 15.9645C17.2575 15.9645 17.5933 16.3002 17.5933 16.7145V18.4393L20.2021 15.8306C20.495 15.5377 20.9699 15.5377 21.2628 15.8306Z" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M2.81293 7.78034C3.10583 8.07323 3.5807 8.07323 3.87359 7.78034L6.48235 5.17158L6.48235 6.89645C6.48235 7.31067 6.81814 7.64645 7.23235 7.64645C7.64656 7.64645 7.98235 7.31067 7.98235 6.89645L7.98235 3.36092C7.98235 3.16201 7.90333 2.97124 7.76268 2.83059C7.62203 2.68994 7.43126 2.61092 7.23235 2.61092L3.69682 2.61092C3.2826 2.61092 2.94682 2.9467 2.94682 3.36092C2.94682 3.77513 3.2826 4.11092 3.69682 4.11092H5.42169L2.81293 6.71968C2.52004 7.01257 2.52004 7.48744 2.81293 7.78034Z" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M8.46203 20.5622C8.66377 20.5827 8.86846 20.5932 9.07561 20.5932C12.3893 20.5932 15.0756 17.9069 15.0756 14.5932C18.3893 14.5932 21.0756 11.9069 21.0756 8.59315C21.0756 5.69362 19.0189 3.27448 16.2847 2.71504C15.9185 2.64011 15.5402 2.59853 15.153 2.59363C15.1272 2.5933 15.1014 2.59314 15.0755 2.59314C11.7618 2.59314 9.07549 5.27943 9.07549 8.59314C5.76179 8.59314 3.07549 11.2794 3.07549 14.5931C3.07549 17.5962 5.28172 20.0839 8.16175 20.524C8.26107 20.5392 8.36118 20.5519 8.46203 20.5622ZM5.07549 14.5931C5.07549 12.384 6.86636 10.5931 9.07549 10.5931C9.19246 10.5931 9.30806 10.5981 9.42214 10.6079C10.0255 12.3008 11.3678 13.6431 13.0607 14.2465C13.0705 14.3606 13.0755 14.4762 13.0755 14.5931C13.0755 16.8023 11.2846 18.5931 9.07549 18.5931C6.86636 18.5931 5.07549 16.8023 5.07549 14.5931ZM11.0755 8.59314C11.0755 6.384 12.8664 4.59314 15.0755 4.59314C17.2846 4.59314 19.0755 6.384 19.0755 8.59314C19.0755 10.8023 17.2846 12.5931 15.0755 12.5931C12.8664 12.5931 11.0755 10.8023 11.0755 8.59314Z" }) ] })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 14481: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 20 20" }, props), { children: [ /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M1.87 6.163a.75.75 0 01-1.06-1.06l2.608-2.61H1.694a.75.75 0 110-1.5h3.535a.75.75 0 01.75.75V5.28a.75.75 0 11-1.5 0V3.554L1.87 6.164zM13.072 1.976a5 5 0 01.421 9.983A6.505 6.505 0 008.09 6.555a5 5 0 014.982-4.579z" }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M12.072 12.976a5 5 0 10-10 0 5 5 0 0010 0zM19.26 14.213a.75.75 0 010 1.061l-2.61 2.609h1.726a.75.75 0 010 1.5H14.84a.75.75 0 01-.75-.75v-3.536a.75.75 0 011.5 0v1.725l2.609-2.609a.75.75 0 011.06 0z" }) ] })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 38514: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 20 20" }, props), { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M10 0C4.478 0 0 4.478 0 9.99 0 15.511 4.478 20 10 20s10-4.488 10-10.01C20 4.477 15.522 0 10 0zm4.925 6.28c-.064.927-1.78 7.856-1.78 7.856s-.107.406-.48.416a.644.644 0 01-.49-.192c-.395-.33-1.29-.97-2.132-1.556a.953.953 0 01-.107.096c-.192.17-.48.416-.789.714a10.7 10.7 0 00-.373.352l-.01.01a2.214 2.214 0 01-.193.171c-.415.341-.458.053-.458-.096l.224-2.441v-.021l.01-.022c.011-.032.033-.043.033-.043s4.36-3.88 4.477-4.296c.01-.021-.021-.042-.074-.021-.288.096-5.31 3.273-5.864 3.625-.032.02-.128.01-.128.01l-2.441-.8s-.288-.117-.192-.383c.021-.053.053-.107.17-.181.544-.384 10-3.785 10-3.785s.267-.085.427-.032c.074.032.117.064.16.17.01.043.021.128.021.224 0 .054-.01.118-.01.224z" }) })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 24985: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 19 17" }, props), { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M16.5 2h-2a2 2 0 00-2-2h-6a2 2 0 00-2 2h-2c-1.1 0-2 .9-2 2v1c0 2.55 1.92 4.63 4.39 4.94A5.01 5.01 0 008.5 12.9V15h-3a1 1 0 100 2h8a1 1 0 100-2h-3v-2.1a5.01 5.01 0 003.61-2.96C16.58 9.63 18.5 7.55 18.5 5V4c0-1.1-.9-2-2-2zm-14 3V4h2v3.82C3.34 7.4 2.5 6.3 2.5 5zm7 6c-1.65 0-3-1.35-3-3V2h6v6c0 1.65-1.35 3-3 3zm7-6c0 1.3-.84 2.4-2 2.82V4h2v1z" }) })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 76306: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 18 20" }, props), { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M5.95.446a1.5 1.5 0 00-1.11 1.808c.08.327.457 1.213.877 2.15H2c-1.1 0-2 .9-2 2v1c0 .319.03.63.087.931.401 2.111 2.142 3.738 4.303 4.009A5.01 5.01 0 008 15.304v2.1H5a1 1 0 100 2h8.006a1 1 0 00-.006-2h-3v-2.1a5.013 5.013 0 003.61-2.96c.309-.039.609-.105.898-.197C16.53 11.507 18 9.635 18 7.404v-1c0-1.1-.9-2-2-2h-3.718c.42-.937.798-1.823.877-2.15a1.5 1.5 0 00-2.918-.7l-.683 2.85H8.442l-.684-2.85A1.5 1.5 0 005.949.446zM16 7.404c0 1.3-.84 2.4-2 2.82v-3.82h2v1zm-12 2.82c-1.16-.42-2-1.52-2-2.82v-1h2v3.82z" }) })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 74167: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 18 15" }, props), { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { fill: "currentColor", d: "M5.659 15c6.79 0 10.507-5.766 10.507-10.763 0-.16 0-.32-.01-.49A7.578 7.578 0 0018 1.79c-.663.3-1.376.5-2.127.6a3.824 3.824 0 001.63-2.1c-.713.44-1.503.75-2.352.92A3.6 3.6 0 0012.46 0C10.419 0 8.76 1.699 8.76 3.787c0 .3.039.58.098.86-3.064-.15-5.786-1.669-7.61-3.957A3.858 3.858 0 00.75 2.598c0 1.31.654 2.469 1.64 3.148a3.638 3.638 0 01-1.669-.47v.05c0 1.83 1.278 3.368 2.956 3.708-.312.09-.634.13-.976.13-.234 0-.468-.02-.692-.07.468 1.509 1.834 2.598 3.453 2.628a7.284 7.284 0 01-4.585 1.62c-.293 0-.595-.01-.878-.05A10.206 10.206 0 005.659 15z" }) })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 82466: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 24 24" }, props), { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M17 4C18.5 4 19 4.5 19 6L19 8C20.1046 8 21 8.89543 21 10L21 17C21 19 20 20 17.999 20H6C4 20 3 19 3 17L3 7C3 5.5 4.5 4 6 4L17 4ZM5 7C5 6.44772 5.44772 6 6 6L19 6L19 8L6 8C5.44772 8 5 7.55229 5 7ZM17 16C18 16 19.001 15 19 14C18.999 13 18 12 17 12C16 12 15 13 15 14C15 15 16 16 17 16Z" }) })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 93617: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44976); var Icon = function Icon(props) { return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({ viewBox: "0 0 24 24" }, props), { children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path", { d: "M4.47 20.9999H19.53C21.07 20.9999 22.03 19.3299 21.26 17.9999L13.73 4.98993C12.96 3.65993 11.04 3.65993 10.27 4.98993L2.74 17.9999C1.97 19.3299 2.93 20.9999 4.47 20.9999ZM12 13.9999C11.45 13.9999 11 13.5499 11 12.9999V10.9999C11 10.4499 11.45 9.99993 12 9.99993C12.55 9.99993 13 10.4499 13 10.9999V12.9999C13 13.5499 12.55 13.9999 12 13.9999ZM13 17.9999H11V15.9999H13V17.9999Z" }) })); }; /* harmony default export */ __webpack_exports__["Z"] = (Icon); /***/ }), /***/ 44976: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7297); /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(87379); /* harmony import */ var styled_system__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(57247); /* harmony import */ var _util_getThemeValue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1983); function _templateObject() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n" ]); _templateObject = function _templateObject() { return data; }; return data; } function _templateObject1() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n animation: ", " 2s linear infinite;\n" ]); _templateObject1 = function _templateObject1() { return data; }; return data; } function _templateObject2() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n align-self: center; // Safari fix\n fill: ", ";\n flex-shrink: 0;\n ", ";\n ", ";\n\n // Safari fix\n @supports (-webkit-text-size-adjust: none) and (not (-ms-accelerator: true)) and (not (-moz-appearance: none)) {\n filter: none !important;\n }\n" ]); _templateObject2 = function _templateObject2() { return data; }; return data; } var rotate = (0,styled_components__WEBPACK_IMPORTED_MODULE_2__/* .keyframes */ .F4)(_templateObject()); var spinStyle = (0,styled_components__WEBPACK_IMPORTED_MODULE_2__/* .css */ .iv)(_templateObject1(), rotate); var Svg = styled_components__WEBPACK_IMPORTED_MODULE_2__/* ["default"].svg.withConfig */ .ZP.svg.withConfig({ componentId: "sc-4ba21b47-0" }).withConfig({ componentId: "sc-8a800401-0" })(_templateObject2(), function(param) { var theme = param.theme, color = param.color; return (0,_util_getThemeValue__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)(theme, "colors.".concat(color), color); }, function(param) { var spin = param.spin; return spin && spinStyle; }, styled_system__WEBPACK_IMPORTED_MODULE_1__/* .space */ .Dh); Svg.defaultProps = { color: "text", width: "20px", xmlns: "http://www.w3.org/2000/svg", spin: false }; /* harmony default export */ __webpack_exports__["Z"] = (Svg); /***/ }), /***/ 62077: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7297); /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(87379); /* harmony import */ var styled_system__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(57247); /* harmony import */ var _util_getThemeValue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1983); function _templateObject() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n color: ", ";\n font-weight: ", ";\n line-height: 1.5;\n ", "\n ", "\n\n ", "\n ", "\n ", "\n\n ", "\n" ]); _templateObject = function _templateObject() { return data; }; return data; } var getColor = function getColor(param) { var color = param.color, theme = param.theme; return (0,_util_getThemeValue__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)(theme, "colors.".concat(color), color); }; var Text = styled_components__WEBPACK_IMPORTED_MODULE_3__/* ["default"].div.withConfig */ .ZP.div.withConfig({ componentId: "sc-c56ebc7d-0" }).withConfig({ componentId: "sc-118b6623-0" })(_templateObject(), getColor, function(param) { var bold = param.bold; return bold ? 600 : 400; }, function(param) { var textTransform = param.textTransform; return textTransform && "text-transform: ".concat(textTransform, ";"); }, function(param) { var ellipsis = param.ellipsis; return ellipsis && "white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;"; }, styled_system__WEBPACK_IMPORTED_MODULE_1__/* .space */ .Dh, styled_system__WEBPACK_IMPORTED_MODULE_1__/* .typography */ .cp, styled_system__WEBPACK_IMPORTED_MODULE_1__/* .layout */ .bK, function(param) { var small = param.small; return small && "font-size: 14px;"; }); Text.defaultProps = { color: "text", small: false, fontSize: "16px", ellipsis: false }; /* harmony default export */ __webpack_exports__["Z"] = (Text); /***/ }), /***/ 54204: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(19685); /* harmony import */ var _Svg__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(624); /* harmony import */ var _Toggle__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(40628); var ThemeSwitcher = function ThemeSwitcher(param) { var isDark = param.isDark, toggleTheme = param.toggleTheme; return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Toggle__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, { checked: isDark, defaultColor: "textDisabled", checkedColor: "textDisabled", onChange: function onChange() { return toggleTheme(!isDark); }, scale: "md", startIcon: function startIcon() { var isActive = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false; return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Svg__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z, { color: isActive ? "warning" : "backgroundAlt" }); }, endIcon: function endIcon() { var isActive = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false; return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_Svg__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, { color: isActive ? "secondary" : "backgroundAlt" }); } }); }; /* harmony default export */ __webpack_exports__["Z"] = (/*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_1__.memo)(ThemeSwitcher, function(prev, next) { return prev.isDark === next.isDark; })); /***/ }), /***/ 47679: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "V": function() { return /* binding */ types; } /* harmony export */ }); var types = { SUCCESS: "success", DANGER: "danger", WARNING: "warning", INFO: "info" }; /***/ }), /***/ 40628: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { "Z": function() { return /* binding */ Toggle_Toggle; } }); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_spread.mjs var _object_spread = __webpack_require__(26042); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_spread_props.mjs var _object_spread_props = __webpack_require__(69396); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_without_properties.mjs + 1 modules var _object_without_properties = __webpack_require__(99534); // EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js var jsx_runtime = __webpack_require__(85893); // EXTERNAL MODULE: ./node_modules/react/index.js var react = __webpack_require__(67294); // EXTERNAL MODULE: ./packages/uikit/src/components/Box/Flex.tsx var Flex = __webpack_require__(75943); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_tagged_template_literal.mjs var _tagged_template_literal = __webpack_require__(7297); // EXTERNAL MODULE: ./node_modules/styled-components/dist/styled-components.browser.esm.js + 4 modules var styled_components_browser_esm = __webpack_require__(87379); ;// CONCATENATED MODULE: ./packages/uikit/src/components/Toggle/types.ts var scales = { SM: "sm", MD: "md", LG: "lg" }; var scaleKeys = { handleHeight: "handleHeight", handleWidth: "handleWidth", handleLeft: "handleLeft", handleTop: "handleTop", checkedLeft: "checkedLeft", toggleHeight: "toggleHeight", toggleWidth: "toggleWidth" }; ;// CONCATENATED MODULE: ./packages/uikit/src/components/Toggle/StyledToggle.tsx function _templateObject() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n background-color: ", ";\n border-radius: 50%;\n cursor: pointer;\n height: ", ";\n left: ", ";\n position: absolute;\n top: ", ";\n transition: left 200ms ease-in;\n width: ", ";\n z-index: 1;\n" ]); _templateObject = function _templateObject() { return data; }; return data; } function _templateObject1() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n cursor: pointer;\n opacity: 0;\n height: 100%;\n position: absolute;\n width: 100%;\n z-index: 3;\n\n &:checked + ", " {\n left: ", ";\n }\n\n &:focus + ", " {\n box-shadow: ", ";\n }\n\n &:hover + ", ":not(:disabled):not(:checked) {\n box-shadow: ", ";\n }\n" ]); _templateObject1 = function _templateObject1() { return data; }; return data; } function _templateObject2() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n align-items: center;\n background-color: ", ";\n border-radius: 24px;\n box-shadow: ", ";\n cursor: pointer;\n display: inline-flex;\n height: ", ";\n position: relative;\n transition: background-color 200ms;\n width: ", ";\n" ]); _templateObject2 = function _templateObject2() { return data; }; return data; } var scaleKeyValues = { sm: { handleHeight: "16px", handleWidth: "16px", handleLeft: "2px", handleTop: "2px", checkedLeft: "calc(100% - 18px)", toggleHeight: "20px", toggleWidth: "36px" }, md: { handleHeight: "26px", handleWidth: "26px", handleLeft: "3px", handleTop: "3px", checkedLeft: "calc(100% - 30px)", toggleHeight: "32px", toggleWidth: "56px" }, lg: { handleHeight: "32px", handleWidth: "32px", handleLeft: "4px", handleTop: "4px", checkedLeft: "calc(100% - 36px)", toggleHeight: "40px", toggleWidth: "72px" } }; var getScale = function getScale(property) { return function(param) { var _scale = param.scale, scale = _scale === void 0 ? scales.LG : _scale; return scaleKeyValues[scale][property]; }; }; var Handle = styled_components_browser_esm/* default.div.withConfig */.ZP.div.withConfig({ componentId: "sc-4d215cc-0" }).withConfig({ componentId: "sc-4f954c25-0" })(_templateObject(), function(param) { var theme = param.theme; return theme.toggle.handleBackground; }, getScale("handleHeight"), getScale("handleLeft"), getScale("handleTop"), getScale("handleWidth")); var Input = styled_components_browser_esm/* default.input.withConfig */.ZP.input.withConfig({ componentId: "sc-4d215cc-1" }).withConfig({ componentId: "sc-4f954c25-1" })(_templateObject1(), Handle, getScale("checkedLeft"), Handle, function(param) { var theme = param.theme; return theme.shadows.focus; }, Handle, function(param) { var theme = param.theme; return theme.shadows.focus; }); var StyledToggle = styled_components_browser_esm/* default.div.withConfig */.ZP.div.withConfig({ componentId: "sc-4d215cc-2" }).withConfig({ componentId: "sc-4f954c25-2" })(_templateObject2(), function(param) { var theme = param.theme, $checked = param.$checked, $checkedColor = param.$checkedColor, $defaultColor = param.$defaultColor; return theme.colors[$checked ? $checkedColor : $defaultColor]; }, function(param) { var theme = param.theme; return theme.shadows.inset; }, getScale("toggleHeight"), getScale("toggleWidth")); /* harmony default export */ var Toggle_StyledToggle = (StyledToggle); ;// CONCATENATED MODULE: ./packages/uikit/src/components/Toggle/Toggle.tsx var Toggle = function Toggle(_param) { var checked = _param.checked, _defaultColor = _param.defaultColor, defaultColor = _defaultColor === void 0 ? "input" : _defaultColor, _checkedColor = _param.checkedColor, checkedColor = _checkedColor === void 0 ? "success" : _checkedColor, _scale = _param.scale, scale = _scale === void 0 ? scales.LG : _scale, startIcon = _param.startIcon, endIcon = _param.endIcon, props = (0,_object_without_properties/* default */.Z)(_param, [ "checked", "defaultColor", "checkedColor", "scale", "startIcon", "endIcon" ]); var isChecked = !!checked; return /*#__PURE__*/ (0,jsx_runtime.jsxs)(Toggle_StyledToggle, { $checked: isChecked, $checkedColor: checkedColor, $defaultColor: defaultColor, scale: scale, children: [ /*#__PURE__*/ (0,jsx_runtime.jsx)(Input, (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({ checked: checked, scale: scale }, props), { type: "checkbox" })), startIcon && endIcon ? /*#__PURE__*/ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, { children: [ /*#__PURE__*/ (0,jsx_runtime.jsx)(Handle, { scale: scale, children: /*#__PURE__*/ (0,jsx_runtime.jsx)(Flex/* default */.Z, { height: "100%", alignItems: "center", justifyContent: "center", children: checked ? endIcon(checked) : startIcon(!checked) }) }), /*#__PURE__*/ (0,jsx_runtime.jsxs)(Flex/* default */.Z, { width: "100%", height: "100%", justifyContent: "space-around", alignItems: "center", children: [ startIcon(), endIcon() ] }) ] }) : /*#__PURE__*/ (0,jsx_runtime.jsx)(Handle, { scale: scale }) ] }); }; /* harmony default export */ var Toggle_Toggle = (Toggle); /***/ }), /***/ 96352: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "R": function() { return /* binding */ light; }, /* harmony export */ "_": function() { return /* binding */ dark; } /* harmony export */ }); /* harmony import */ var _theme_colors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16557); var light = { handleBackground: _theme_colors__WEBPACK_IMPORTED_MODULE_0__/* .lightColors.backgroundAlt */ .C.backgroundAlt }; var dark = { handleBackground: _theme_colors__WEBPACK_IMPORTED_MODULE_0__/* .darkColors.backgroundAlt */ ._.backgroundAlt }; /***/ }), /***/ 38800: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "R": function() { return /* binding */ light; }, /* harmony export */ "_": function() { return /* binding */ dark; } /* harmony export */ }); /* harmony import */ var _pancakeswap_ui_css_vars_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(41727); /* harmony import */ var _theme_colors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16557); var light = { background: _theme_colors__WEBPACK_IMPORTED_MODULE_1__/* .darkColors.backgroundAlt */ ._.backgroundAlt, text: _theme_colors__WEBPACK_IMPORTED_MODULE_1__/* .darkColors.text */ ._.text, boxShadow: _pancakeswap_ui_css_vars_css__WEBPACK_IMPORTED_MODULE_0__/* .vars.shadows.tooltip */ .g.shadows.tooltip }; var dark = { background: _theme_colors__WEBPACK_IMPORTED_MODULE_1__/* .lightColors.backgroundAlt */ .C.backgroundAlt, text: _theme_colors__WEBPACK_IMPORTED_MODULE_1__/* .lightColors.text */ .C.text, boxShadow: _pancakeswap_ui_css_vars_css__WEBPACK_IMPORTED_MODULE_0__/* .vars.shadows.tooltip */ .g.shadows.tooltip }; /***/ }), /***/ 73588: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "kE": function() { return /* binding */ MatchBreakpointsContext; }, /* harmony export */ "mh": function() { return /* binding */ MatchBreakpointsProvider; } /* harmony export */ }); /* unused harmony export getBreakpointChecks */ /* harmony import */ var _swc_helpers_src_define_property_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(14924); /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69396); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var _pancakeswap_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4857); /* harmony import */ var _hooks_useIsomorphicEffect__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(87613); /** * Can't use the media queries from "base.mediaQueries" because of how matchMedia works * In order for the listener to trigger we need have the media query with a range, e.g. * (min-width: 370px) and (max-width: 576px) * @see https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList */ var mediaQueries = function() { var prevMinWidth = 0; return Object.keys(_pancakeswap_ui__WEBPACK_IMPORTED_MODULE_2__/* .breakpoints */ .AV).reduce(function(accum, size, index) { // Largest size is just a min-width of second highest max-width if (index === Object.keys(_pancakeswap_ui__WEBPACK_IMPORTED_MODULE_2__/* .breakpoints */ .AV).length - 1) { return (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({}, accum), (0,_swc_helpers_src_define_property_mjs__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z)({}, size, "(min-width: ".concat(prevMinWidth, "px)"))); } var minWidth = prevMinWidth; // @ts-ignore var breakpoint = _pancakeswap_ui__WEBPACK_IMPORTED_MODULE_2__/* .breakpoints */ .AV[size]; // Min width for next iteration prevMinWidth = breakpoint; return (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({}, accum), (0,_swc_helpers_src_define_property_mjs__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z)({}, size, "(min-width: ".concat(minWidth, "px) and (max-width: ").concat(breakpoint - 1, "px)"))); }, {}); }(); var getKey = function getKey(size) { return "is".concat(size.charAt(0).toUpperCase()).concat(size.slice(1)); }; var getState = function getState() { var s = Object.keys(mediaQueries).reduce(function(accum, size) { var key = getKey(size); if (false) {} var mql = typeof (window === null || window === void 0 ? void 0 : window.matchMedia) === "function" ? window.matchMedia(mediaQueries[size]) : null; var ref; return (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({}, accum), (0,_swc_helpers_src_define_property_mjs__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z)({}, key, (ref = mql === null || mql === void 0 ? void 0 : mql.matches) !== null && ref !== void 0 ? ref : false)); }, {}); return s; }; var MatchBreakpointsContext = /*#__PURE__*/ (0,react__WEBPACK_IMPORTED_MODULE_1__.createContext)({ isMobile: false, isTablet: false, isDesktop: false }); var getBreakpointChecks = function getBreakpointChecks(state) { return (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({}, state), { isMobile: state.isXs || state.isSm, isTablet: state.isMd || state.isLg, isDesktop: state.isXl || state.isXxl }); }; var MatchBreakpointsProvider = function MatchBreakpointsProvider(param) { var children = param.children; var ref = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(function() { return getBreakpointChecks(getState()); }), state = ref[0], setState = ref[1]; (0,_hooks_useIsomorphicEffect__WEBPACK_IMPORTED_MODULE_6__/* .useIsomorphicEffect */ .Y)(function() { // Create listeners for each media query returning a function to unsubscribe var handlers = Object.keys(mediaQueries).map(function(size) { var mql; var handler; if (typeof (window === null || window === void 0 ? void 0 : window.matchMedia) === "function") { mql = window.matchMedia(mediaQueries[size]); handler = function handler(matchMediaQuery) { var key = getKey(size); setState(function(prevState) { return getBreakpointChecks((0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)({}, prevState), (0,_swc_helpers_src_define_property_mjs__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z)({}, key, matchMediaQuery.matches))); }); }; // Safari < 14 fix if (mql.addEventListener) { mql.addEventListener("change", handler); } } return function() { // Safari < 14 fix if (mql === null || mql === void 0 ? void 0 : mql.removeEventListener) { mql.removeEventListener("change", handler); } }; }); setState(getBreakpointChecks(getState())); return function() { handlers.forEach(function(unsubscribe) { unsubscribe(); }); }; }, []); return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(MatchBreakpointsContext.Provider, { value: state, children: children }); }; /***/ }), /***/ 34701: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(67294); /* harmony import */ var _Provider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(73588); var useMatchBreakpoints = function useMatchBreakpoints() { var matchBreakpointContext = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_Provider__WEBPACK_IMPORTED_MODULE_1__/* .MatchBreakpointsContext */ .kE); if (matchBreakpointContext === undefined) { throw new Error("Match Breakpoint context is undefined"); } return matchBreakpointContext; }; /* harmony default export */ __webpack_exports__["Z"] = (useMatchBreakpoints); /***/ }), /***/ 18514: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { "Z": function() { return /* binding */ Listener; } }); // EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js var jsx_runtime = __webpack_require__(85893); // EXTERNAL MODULE: ./node_modules/react/index.js var react = __webpack_require__(67294); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_tagged_template_literal.mjs var _tagged_template_literal = __webpack_require__(7297); ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js var esm_extends = __webpack_require__(87462); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js var assertThisInitialized = __webpack_require__(97326); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js + 1 modules var inheritsLoose = __webpack_require__(75068); ;// CONCATENATED MODULE: ./node_modules/react-transition-group/esm/TransitionGroupContext.js /* harmony default export */ var TransitionGroupContext = (react.createContext(null)); ;// CONCATENATED MODULE: ./node_modules/react-transition-group/esm/utils/ChildMapping.js /** * Given `this.props.children`, return an object mapping key to child. * * @param {*} children `this.props.children` * @return {object} Mapping of key to child */ function getChildMapping(children, mapFn) { var mapper = function mapper(child) { return mapFn && (0,react.isValidElement)(child) ? mapFn(child) : child; }; var result = Object.create(null); if (children) react.Children.map(children, function (c) { return c; }).forEach(function (child) { // run the map function here instead so that the key is the computed one result[child.key] = mapper(child); }); return result; } /** * When you're adding or removing children some may be added or removed in the * same render pass. We want to show *both* since we want to simultaneously * animate elements in and out. This function takes a previous set of keys * and a new set of keys and merges them with its best guess of the correct * ordering. In the future we may expose some of the utilities in * ReactMultiChild to make this easy, but for now React itself does not * directly have this concept of the union of prevChildren and nextChildren * so we implement it here. * * @param {object} prev prev children as returned from * `ReactTransitionChildMapping.getChildMapping()`. * @param {object} next next children as returned from * `ReactTransitionChildMapping.getChildMapping()`. * @return {object} a key set that contains all keys in `prev` and all keys * in `next` in a reasonable order. */ function mergeChildMappings(prev, next) { prev = prev || {}; next = next || {}; function getValueForKey(key) { return key in next ? next[key] : prev[key]; } // For each key of `next`, the list of keys to insert before that key in // the combined list var nextKeysPending = Object.create(null); var pendingKeys = []; for (var prevKey in prev) { if (prevKey in next) { if (pendingKeys.length) { nextKeysPending[prevKey] = pendingKeys; pendingKeys = []; } } else { pendingKeys.push(prevKey); } } var i; var childMapping = {}; for (var nextKey in next) { if (nextKeysPending[nextKey]) { for (i = 0; i < nextKeysPending[nextKey].length; i++) { var pendingNextKey = nextKeysPending[nextKey][i]; childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey); } } childMapping[nextKey] = getValueForKey(nextKey); } // Finally, add the keys which didn't appear before any key in `next` for (i = 0; i < pendingKeys.length; i++) { childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]); } return childMapping; } function getProp(child, prop, props) { return props[prop] != null ? props[prop] : child.props[prop]; } function getInitialChildMapping(props, onExited) { return getChildMapping(props.children, function (child) { return (0,react.cloneElement)(child, { onExited: onExited.bind(null, child), in: true, appear: getProp(child, 'appear', props), enter: getProp(child, 'enter', props), exit: getProp(child, 'exit', props) }); }); } function getNextChildMapping(nextProps, prevChildMapping, onExited) { var nextChildMapping = getChildMapping(nextProps.children); var children = mergeChildMappings(prevChildMapping, nextChildMapping); Object.keys(children).forEach(function (key) { var child = children[key]; if (!(0,react.isValidElement)(child)) return; var hasPrev = (key in prevChildMapping); var hasNext = (key in nextChildMapping); var prevChild = prevChildMapping[key]; var isLeaving = (0,react.isValidElement)(prevChild) && !prevChild.props.in; // item is new (entering) if (hasNext && (!hasPrev || isLeaving)) { // console.log('entering', key) children[key] = (0,react.cloneElement)(child, { onExited: onExited.bind(null, child), in: true, exit: getProp(child, 'exit', nextProps), enter: getProp(child, 'enter', nextProps) }); } else if (!hasNext && hasPrev && !isLeaving) { // item is old (exiting) // console.log('leaving', key) children[key] = (0,react.cloneElement)(child, { in: false }); } else if (hasNext && hasPrev && (0,react.isValidElement)(prevChild)) { // item hasn't changed transition states // copy over the last transition props; // console.log('unchanged', key) children[key] = (0,react.cloneElement)(child, { onExited: onExited.bind(null, child), in: prevChild.props.in, exit: getProp(child, 'exit', nextProps), enter: getProp(child, 'enter', nextProps) }); } }); return children; } ;// CONCATENATED MODULE: ./node_modules/react-transition-group/esm/TransitionGroup.js var values = Object.values || function (obj) { return Object.keys(obj).map(function (k) { return obj[k]; }); }; var defaultProps = { component: 'div', childFactory: function childFactory(child) { return child; } }; /** * The `` component manages a set of transition components * (`` and ``) in a list. Like with the transition * components, `` is a state machine for managing the mounting * and unmounting of components over time. * * Consider the example below. As items are removed or added to the TodoList the * `in` prop is toggled automatically by the ``. * * Note that `` does not define any animation behavior! * Exactly _how_ a list item animates is up to the individual transition * component. This means you can mix and match animations across different list * items. */ var TransitionGroup = /*#__PURE__*/function (_React$Component) { (0,inheritsLoose/* default */.Z)(TransitionGroup, _React$Component); function TransitionGroup(props, context) { var _this; _this = _React$Component.call(this, props, context) || this; var handleExited = _this.handleExited.bind((0,assertThisInitialized/* default */.Z)(_this)); // Initial children should all be entering, dependent on appear _this.state = { contextValue: { isMounting: true }, handleExited: handleExited, firstRender: true }; return _this; } var _proto = TransitionGroup.prototype; _proto.componentDidMount = function componentDidMount() { this.mounted = true; this.setState({ contextValue: { isMounting: false } }); }; _proto.componentWillUnmount = function componentWillUnmount() { this.mounted = false; }; TransitionGroup.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, _ref) { var prevChildMapping = _ref.children, handleExited = _ref.handleExited, firstRender = _ref.firstRender; return { children: firstRender ? getInitialChildMapping(nextProps, handleExited) : getNextChildMapping(nextProps, prevChildMapping, handleExited), firstRender: false }; } // node is `undefined` when user provided `nodeRef` prop ; _proto.handleExited = function handleExited(child, node) { var currentChildMapping = getChildMapping(this.props.children); if (child.key in currentChildMapping) return; if (child.props.onExited) { child.props.onExited(node); } if (this.mounted) { this.setState(function (state) { var children = (0,esm_extends/* default */.Z)({}, state.children); delete children[child.key]; return { children: children }; }); } }; _proto.render = function render() { var _this$props = this.props, Component = _this$props.component, childFactory = _this$props.childFactory, props = _objectWithoutPropertiesLoose(_this$props, ["component", "childFactory"]); var contextValue = this.state.contextValue; var children = values(this.state.children).map(childFactory); delete props.appear; delete props.enter; delete props.exit; if (Component === null) { return /*#__PURE__*/react.createElement(TransitionGroupContext.Provider, { value: contextValue }, children); } return /*#__PURE__*/react.createElement(TransitionGroupContext.Provider, { value: contextValue }, /*#__PURE__*/react.createElement(Component, props, children)); }; return TransitionGroup; }(react.Component); TransitionGroup.propTypes = false ? 0 : {}; TransitionGroup.defaultProps = defaultProps; /* harmony default export */ var esm_TransitionGroup = (TransitionGroup); // EXTERNAL MODULE: ./node_modules/styled-components/dist/styled-components.browser.esm.js + 4 modules var styled_components_browser_esm = __webpack_require__(87379); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_define_property.mjs var _define_property = __webpack_require__(14924); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_spread.mjs var _object_spread = __webpack_require__(26042); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_spread_props.mjs var _object_spread_props = __webpack_require__(69396); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_without_properties.mjs + 1 modules var _object_without_properties = __webpack_require__(99534); ;// CONCATENATED MODULE: ./node_modules/dom-helpers/esm/hasClass.js /** * Checks if a given element has a CSS class. * * @param element the element * @param className the CSS class name */ function hasClass(element, className) { if (element.classList) return !!className && element.classList.contains(className); return (" " + (element.className.baseVal || element.className) + " ").indexOf(" " + className + " ") !== -1; } ;// CONCATENATED MODULE: ./node_modules/dom-helpers/esm/addClass.js /** * Adds a CSS class to a given element. * * @param element the element * @param className the CSS class name */ function addClass_addClass(element, className) { if (element.classList) element.classList.add(className);else if (!hasClass(element, className)) if (typeof element.className === 'string') element.className = element.className + " " + className;else element.setAttribute('class', (element.className && element.className.baseVal || '') + " " + className); } ;// CONCATENATED MODULE: ./node_modules/dom-helpers/esm/removeClass.js function replaceClassName(origClass, classToRemove) { return origClass.replace(new RegExp("(^|\\s)" + classToRemove + "(?:\\s|$)", 'g'), '$1').replace(/\s+/g, ' ').replace(/^\s*|\s*$/g, ''); } /** * Removes a CSS class from a given element. * * @param element the element * @param className the CSS class name */ function removeClass_removeClass(element, className) { if (element.classList) { element.classList.remove(className); } else if (typeof element.className === 'string') { element.className = replaceClassName(element.className, className); } else { element.setAttribute('class', replaceClassName(element.className && element.className.baseVal || '', className)); } } // EXTERNAL MODULE: ./node_modules/react-dom/index.js var react_dom = __webpack_require__(73935); ;// CONCATENATED MODULE: ./node_modules/react-transition-group/esm/config.js /* harmony default export */ var config = ({ disabled: false }); ;// CONCATENATED MODULE: ./node_modules/react-transition-group/esm/Transition.js var UNMOUNTED = 'unmounted'; var EXITED = 'exited'; var ENTERING = 'entering'; var ENTERED = 'entered'; var EXITING = 'exiting'; /** * The Transition component lets you describe a transition from one component * state to another _over time_ with a simple declarative API. Most commonly * it's used to animate the mounting and unmounting of a component, but can also * be used to describe in-place transition states as well. * * --- * * **Note**: `Transition` is a platform-agnostic base component. If you're using * transitions in CSS, you'll probably want to use * [`CSSTransition`](https://reactcommunity.org/react-transition-group/css-transition) * instead. It inherits all the features of `Transition`, but contains * additional features necessary to play nice with CSS transitions (hence the * name of the component). * * --- * * By default the `Transition` component does not alter the behavior of the * component it renders, it only tracks "enter" and "exit" states for the * components. It's up to you to give meaning and effect to those states. For * example we can add styles to a component when it enters or exits: * * ```jsx * import { Transition } from 'react-transition-group'; * * const duration = 300; * * const defaultStyle = { * transition: `opacity ${duration}ms ease-in-out`, * opacity: 0, * } * * const transitionStyles = { * entering: { opacity: 1 }, * entered: { opacity: 1 }, * exiting: { opacity: 0 }, * exited: { opacity: 0 }, * }; * * const Fade = ({ in: inProp }) => ( * * {state => ( *
* I'm a fade Transition! *
* )} *
* ); * ``` * * There are 4 main states a Transition can be in: * - `'entering'` * - `'entered'` * - `'exiting'` * - `'exited'` * * Transition state is toggled via the `in` prop. When `true` the component * begins the "Enter" stage. During this stage, the component will shift from * its current transition state, to `'entering'` for the duration of the * transition and then to the `'entered'` stage once it's complete. Let's take * the following example (we'll use the * [useState](https://reactjs.org/docs/hooks-reference.html#usestate) hook): * * ```jsx * function App() { * const [inProp, setInProp] = useState(false); * return ( *
* * {state => ( * // ... * )} * * *
* ); * } * ``` * * When the button is clicked the component will shift to the `'entering'` state * and stay there for 500ms (the value of `timeout`) before it finally switches * to `'entered'`. * * When `in` is `false` the same thing happens except the state moves from * `'exiting'` to `'exited'`. */ var Transition = /*#__PURE__*/function (_React$Component) { (0,inheritsLoose/* default */.Z)(Transition, _React$Component); function Transition(props, context) { var _this; _this = _React$Component.call(this, props, context) || this; var parentGroup = context; // In the context of a TransitionGroup all enters are really appears var appear = parentGroup && !parentGroup.isMounting ? props.enter : props.appear; var initialStatus; _this.appearStatus = null; if (props.in) { if (appear) { initialStatus = EXITED; _this.appearStatus = ENTERING; } else { initialStatus = ENTERED; } } else { if (props.unmountOnExit || props.mountOnEnter) { initialStatus = UNMOUNTED; } else { initialStatus = EXITED; } } _this.state = { status: initialStatus }; _this.nextCallback = null; return _this; } Transition.getDerivedStateFromProps = function getDerivedStateFromProps(_ref, prevState) { var nextIn = _ref.in; if (nextIn && prevState.status === UNMOUNTED) { return { status: EXITED }; } return null; } // getSnapshotBeforeUpdate(prevProps) { // let nextStatus = null // if (prevProps !== this.props) { // const { status } = this.state // if (this.props.in) { // if (status !== ENTERING && status !== ENTERED) { // nextStatus = ENTERING // } // } else { // if (status === ENTERING || status === ENTERED) { // nextStatus = EXITING // } // } // } // return { nextStatus } // } ; var _proto = Transition.prototype; _proto.componentDidMount = function componentDidMount() { this.updateStatus(true, this.appearStatus); }; _proto.componentDidUpdate = function componentDidUpdate(prevProps) { var nextStatus = null; if (prevProps !== this.props) { var status = this.state.status; if (this.props.in) { if (status !== ENTERING && status !== ENTERED) { nextStatus = ENTERING; } } else { if (status === ENTERING || status === ENTERED) { nextStatus = EXITING; } } } this.updateStatus(false, nextStatus); }; _proto.componentWillUnmount = function componentWillUnmount() { this.cancelNextCallback(); }; _proto.getTimeouts = function getTimeouts() { var timeout = this.props.timeout; var exit, enter, appear; exit = enter = appear = timeout; if (timeout != null && typeof timeout !== 'number') { exit = timeout.exit; enter = timeout.enter; // TODO: remove fallback for next major appear = timeout.appear !== undefined ? timeout.appear : enter; } return { exit: exit, enter: enter, appear: appear }; }; _proto.updateStatus = function updateStatus(mounting, nextStatus) { if (mounting === void 0) { mounting = false; } if (nextStatus !== null) { // nextStatus will always be ENTERING or EXITING. this.cancelNextCallback(); if (nextStatus === ENTERING) { this.performEnter(mounting); } else { this.performExit(); } } else if (this.props.unmountOnExit && this.state.status === EXITED) { this.setState({ status: UNMOUNTED }); } }; _proto.performEnter = function performEnter(mounting) { var _this2 = this; var enter = this.props.enter; var appearing = this.context ? this.context.isMounting : mounting; var _ref2 = this.props.nodeRef ? [appearing] : [react_dom.findDOMNode(this), appearing], maybeNode = _ref2[0], maybeAppearing = _ref2[1]; var timeouts = this.getTimeouts(); var enterTimeout = appearing ? timeouts.appear : timeouts.enter; // no enter animation skip right to ENTERED // if we are mounting and running this it means appear _must_ be set if (!mounting && !enter || config.disabled) { this.safeSetState({ status: ENTERED }, function () { _this2.props.onEntered(maybeNode); }); return; } this.props.onEnter(maybeNode, maybeAppearing); this.safeSetState({ status: ENTERING }, function () { _this2.props.onEntering(maybeNode, maybeAppearing); _this2.onTransitionEnd(enterTimeout, function () { _this2.safeSetState({ status: ENTERED }, function () { _this2.props.onEntered(maybeNode, maybeAppearing); }); }); }); }; _proto.performExit = function performExit() { var _this3 = this; var exit = this.props.exit; var timeouts = this.getTimeouts(); var maybeNode = this.props.nodeRef ? undefined : react_dom.findDOMNode(this); // no exit animation skip right to EXITED if (!exit || config.disabled) { this.safeSetState({ status: EXITED }, function () { _this3.props.onExited(maybeNode); }); return; } this.props.onExit(maybeNode); this.safeSetState({ status: EXITING }, function () { _this3.props.onExiting(maybeNode); _this3.onTransitionEnd(timeouts.exit, function () { _this3.safeSetState({ status: EXITED }, function () { _this3.props.onExited(maybeNode); }); }); }); }; _proto.cancelNextCallback = function cancelNextCallback() { if (this.nextCallback !== null) { this.nextCallback.cancel(); this.nextCallback = null; } }; _proto.safeSetState = function safeSetState(nextState, callback) { // This shouldn't be necessary, but there are weird race conditions with // setState callbacks and unmounting in testing, so always make sure that // we can cancel any pending setState callbacks after we unmount. callback = this.setNextCallback(callback); this.setState(nextState, callback); }; _proto.setNextCallback = function setNextCallback(callback) { var _this4 = this; var active = true; this.nextCallback = function (event) { if (active) { active = false; _this4.nextCallback = null; callback(event); } }; this.nextCallback.cancel = function () { active = false; }; return this.nextCallback; }; _proto.onTransitionEnd = function onTransitionEnd(timeout, handler) { this.setNextCallback(handler); var node = this.props.nodeRef ? this.props.nodeRef.current : react_dom.findDOMNode(this); var doesNotHaveTimeoutOrListener = timeout == null && !this.props.addEndListener; if (!node || doesNotHaveTimeoutOrListener) { setTimeout(this.nextCallback, 0); return; } if (this.props.addEndListener) { var _ref3 = this.props.nodeRef ? [this.nextCallback] : [node, this.nextCallback], maybeNode = _ref3[0], maybeNextCallback = _ref3[1]; this.props.addEndListener(maybeNode, maybeNextCallback); } if (timeout != null) { setTimeout(this.nextCallback, timeout); } }; _proto.render = function render() { var status = this.state.status; if (status === UNMOUNTED) { return null; } var _this$props = this.props, children = _this$props.children, _in = _this$props.in, _mountOnEnter = _this$props.mountOnEnter, _unmountOnExit = _this$props.unmountOnExit, _appear = _this$props.appear, _enter = _this$props.enter, _exit = _this$props.exit, _timeout = _this$props.timeout, _addEndListener = _this$props.addEndListener, _onEnter = _this$props.onEnter, _onEntering = _this$props.onEntering, _onEntered = _this$props.onEntered, _onExit = _this$props.onExit, _onExiting = _this$props.onExiting, _onExited = _this$props.onExited, _nodeRef = _this$props.nodeRef, childProps = _objectWithoutPropertiesLoose(_this$props, ["children", "in", "mountOnEnter", "unmountOnExit", "appear", "enter", "exit", "timeout", "addEndListener", "onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited", "nodeRef"]); return ( /*#__PURE__*/ // allows for nested Transitions react.createElement(TransitionGroupContext.Provider, { value: null }, typeof children === 'function' ? children(status, childProps) : react.cloneElement(react.Children.only(children), childProps)) ); }; return Transition; }(react.Component); Transition.contextType = TransitionGroupContext; Transition.propTypes = false ? 0 : {}; // Name the function so it is clearer in the documentation function noop() {} Transition.defaultProps = { in: false, mountOnEnter: false, unmountOnExit: false, appear: false, enter: true, exit: true, onEnter: noop, onEntering: noop, onEntered: noop, onExit: noop, onExiting: noop, onExited: noop }; Transition.UNMOUNTED = UNMOUNTED; Transition.EXITED = EXITED; Transition.ENTERING = ENTERING; Transition.ENTERED = ENTERED; Transition.EXITING = EXITING; /* harmony default export */ var esm_Transition = (Transition); ;// CONCATENATED MODULE: ./node_modules/react-transition-group/esm/CSSTransition.js var _addClass = function addClass(node, classes) { return node && classes && classes.split(' ').forEach(function (c) { return addClass_addClass(node, c); }); }; var removeClass = function removeClass(node, classes) { return node && classes && classes.split(' ').forEach(function (c) { return removeClass_removeClass(node, c); }); }; /** * A transition component inspired by the excellent * [ng-animate](https://docs.angularjs.org/api/ngAnimate) library, you should * use it if you're using CSS transitions or animations. It's built upon the * [`Transition`](https://reactcommunity.org/react-transition-group/transition) * component, so it inherits all of its props. * * `CSSTransition` applies a pair of class names during the `appear`, `enter`, * and `exit` states of the transition. The first class is applied and then a * second `*-active` class in order to activate the CSS transition. After the * transition, matching `*-done` class names are applied to persist the * transition state. * * ```jsx * function App() { * const [inProp, setInProp] = useState(false); * return ( *
* *
* {"I'll receive my-node-* classes"} *
*
* *
* ); * } * ``` * * When the `in` prop is set to `true`, the child component will first receive * the class `example-enter`, then the `example-enter-active` will be added in * the next tick. `CSSTransition` [forces a * reflow](https://github.com/reactjs/react-transition-group/blob/5007303e729a74be66a21c3e2205e4916821524b/src/CSSTransition.js#L208-L215) * between before adding the `example-enter-active`. This is an important trick * because it allows us to transition between `example-enter` and * `example-enter-active` even though they were added immediately one after * another. Most notably, this is what makes it possible for us to animate * _appearance_. * * ```css * .my-node-enter { * opacity: 0; * } * .my-node-enter-active { * opacity: 1; * transition: opacity 200ms; * } * .my-node-exit { * opacity: 1; * } * .my-node-exit-active { * opacity: 0; * transition: opacity 200ms; * } * ``` * * `*-active` classes represent which styles you want to animate **to**, so it's * important to add `transition` declaration only to them, otherwise transitions * might not behave as intended! This might not be obvious when the transitions * are symmetrical, i.e. when `*-enter-active` is the same as `*-exit`, like in * the example above (minus `transition`), but it becomes apparent in more * complex transitions. * * **Note**: If you're using the * [`appear`](http://reactcommunity.org/react-transition-group/transition#Transition-prop-appear) * prop, make sure to define styles for `.appear-*` classes as well. */ var CSSTransition = /*#__PURE__*/function (_React$Component) { (0,inheritsLoose/* default */.Z)(CSSTransition, _React$Component); function CSSTransition() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this; _this.appliedClasses = { appear: {}, enter: {}, exit: {} }; _this.onEnter = function (maybeNode, maybeAppearing) { var _this$resolveArgument = _this.resolveArguments(maybeNode, maybeAppearing), node = _this$resolveArgument[0], appearing = _this$resolveArgument[1]; _this.removeClasses(node, 'exit'); _this.addClass(node, appearing ? 'appear' : 'enter', 'base'); if (_this.props.onEnter) { _this.props.onEnter(maybeNode, maybeAppearing); } }; _this.onEntering = function (maybeNode, maybeAppearing) { var _this$resolveArgument2 = _this.resolveArguments(maybeNode, maybeAppearing), node = _this$resolveArgument2[0], appearing = _this$resolveArgument2[1]; var type = appearing ? 'appear' : 'enter'; _this.addClass(node, type, 'active'); if (_this.props.onEntering) { _this.props.onEntering(maybeNode, maybeAppearing); } }; _this.onEntered = function (maybeNode, maybeAppearing) { var _this$resolveArgument3 = _this.resolveArguments(maybeNode, maybeAppearing), node = _this$resolveArgument3[0], appearing = _this$resolveArgument3[1]; var type = appearing ? 'appear' : 'enter'; _this.removeClasses(node, type); _this.addClass(node, type, 'done'); if (_this.props.onEntered) { _this.props.onEntered(maybeNode, maybeAppearing); } }; _this.onExit = function (maybeNode) { var _this$resolveArgument4 = _this.resolveArguments(maybeNode), node = _this$resolveArgument4[0]; _this.removeClasses(node, 'appear'); _this.removeClasses(node, 'enter'); _this.addClass(node, 'exit', 'base'); if (_this.props.onExit) { _this.props.onExit(maybeNode); } }; _this.onExiting = function (maybeNode) { var _this$resolveArgument5 = _this.resolveArguments(maybeNode), node = _this$resolveArgument5[0]; _this.addClass(node, 'exit', 'active'); if (_this.props.onExiting) { _this.props.onExiting(maybeNode); } }; _this.onExited = function (maybeNode) { var _this$resolveArgument6 = _this.resolveArguments(maybeNode), node = _this$resolveArgument6[0]; _this.removeClasses(node, 'exit'); _this.addClass(node, 'exit', 'done'); if (_this.props.onExited) { _this.props.onExited(maybeNode); } }; _this.resolveArguments = function (maybeNode, maybeAppearing) { return _this.props.nodeRef ? [_this.props.nodeRef.current, maybeNode] // here `maybeNode` is actually `appearing` : [maybeNode, maybeAppearing]; }; _this.getClassNames = function (type) { var classNames = _this.props.classNames; var isStringClassNames = typeof classNames === 'string'; var prefix = isStringClassNames && classNames ? classNames + "-" : ''; var baseClassName = isStringClassNames ? "" + prefix + type : classNames[type]; var activeClassName = isStringClassNames ? baseClassName + "-active" : classNames[type + "Active"]; var doneClassName = isStringClassNames ? baseClassName + "-done" : classNames[type + "Done"]; return { baseClassName: baseClassName, activeClassName: activeClassName, doneClassName: doneClassName }; }; return _this; } var _proto = CSSTransition.prototype; _proto.addClass = function addClass(node, type, phase) { var className = this.getClassNames(type)[phase + "ClassName"]; var _this$getClassNames = this.getClassNames('enter'), doneClassName = _this$getClassNames.doneClassName; if (type === 'appear' && phase === 'done' && doneClassName) { className += " " + doneClassName; } // This is to force a repaint, // which is necessary in order to transition styles when adding a class name. if (phase === 'active') { /* eslint-disable no-unused-expressions */ node && node.scrollTop; } if (className) { this.appliedClasses[type][phase] = className; _addClass(node, className); } }; _proto.removeClasses = function removeClasses(node, type) { var _this$appliedClasses$ = this.appliedClasses[type], baseClassName = _this$appliedClasses$.base, activeClassName = _this$appliedClasses$.active, doneClassName = _this$appliedClasses$.done; this.appliedClasses[type] = {}; if (baseClassName) { removeClass(node, baseClassName); } if (activeClassName) { removeClass(node, activeClassName); } if (doneClassName) { removeClass(node, doneClassName); } }; _proto.render = function render() { var _this$props = this.props, _ = _this$props.classNames, props = _objectWithoutPropertiesLoose(_this$props, ["classNames"]); return /*#__PURE__*/react.createElement(esm_Transition, (0,esm_extends/* default */.Z)({}, props, { onEnter: this.onEnter, onEntered: this.onEntered, onEntering: this.onEntering, onExit: this.onExit, onExiting: this.onExiting, onExited: this.onExited })); }; return CSSTransition; }(react.Component); CSSTransition.defaultProps = { classNames: '' }; CSSTransition.propTypes = false ? 0 : {}; /* harmony default export */ var esm_CSSTransition = (CSSTransition); // EXTERNAL MODULE: ./packages/uikit/src/components/Alert/types.ts var types = __webpack_require__(46842); // EXTERNAL MODULE: ./packages/uikit/src/components/Alert/Alert.tsx var Alert = __webpack_require__(78947); // EXTERNAL MODULE: ./packages/uikit/src/components/Toast/types.ts var Toast_types = __webpack_require__(47679); ;// CONCATENATED MODULE: ./packages/uikit/src/components/Toast/Toast.tsx function _templateObject() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n right: 16px;\n position: fixed;\n max-width: calc(100% - 32px);\n transition: all 250ms ease-in;\n width: 100%;\n\n ", " {\n max-width: 400px;\n }\n" ]); _templateObject = function _templateObject() { return data; }; return data; } var _obj; var alertTypeMap = (_obj = {}, (0,_define_property/* default */.Z)(_obj, Toast_types/* types.INFO */.V.INFO, types/* variants.INFO */.o.INFO), (0,_define_property/* default */.Z)(_obj, Toast_types/* types.SUCCESS */.V.SUCCESS, types/* variants.SUCCESS */.o.SUCCESS), (0,_define_property/* default */.Z)(_obj, Toast_types/* types.DANGER */.V.DANGER, types/* variants.DANGER */.o.DANGER), (0,_define_property/* default */.Z)(_obj, Toast_types/* types.WARNING */.V.WARNING, types/* variants.WARNING */.o.WARNING), _obj); var StyledToast = styled_components_browser_esm/* default.div.withConfig */.ZP.div.withConfig({ componentId: "sc-eff9dc52-0" }).withConfig({ componentId: "sc-893bddea-0" })(_templateObject(), function(param) { var theme = param.theme; return theme.mediaQueries.sm; }); var Toast = function Toast(_param) { var toast = _param.toast, onRemove = _param.onRemove, style = _param.style, ttl = _param.ttl, props = (0,_object_without_properties/* default */.Z)(_param, [ "toast", "onRemove", "style", "ttl" ]); var timer = (0,react.useRef)(); var id = toast.id, title = toast.title, description = toast.description, type = toast.type; var handleRemove = (0,react.useCallback)(function() { return onRemove(id); }, [ id, onRemove ]); var handleMouseEnter = function handleMouseEnter() { clearTimeout(timer.current); }; var handleMouseLeave = function handleMouseLeave() { if (timer.current) { clearTimeout(timer.current); } timer.current = window.setTimeout(function() { handleRemove(); }, ttl); }; (0,react.useEffect)(function() { if (timer.current) { clearTimeout(timer.current); } timer.current = window.setTimeout(function() { handleRemove(); }, ttl); return function() { clearTimeout(timer.current); }; }, [ timer, ttl, handleRemove ]); return /*#__PURE__*/ (0,jsx_runtime.jsx)(esm_CSSTransition, (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({ timeout: 250, style: style }, props), { children: /*#__PURE__*/ (0,jsx_runtime.jsx)(StyledToast, { onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, children: /*#__PURE__*/ (0,jsx_runtime.jsx)(Alert/* default */.Z, { title: title, variant: alertTypeMap[type], onClick: handleRemove, children: description }) }) })); }; ;// CONCATENATED MODULE: ./packages/uikit/src/components/Toast/ToastContainer.tsx function ToastContainer_templateObject() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n .enter,\n .appear {\n opacity: 0.01;\n }\n\n .enter.enter-active,\n .appear.appear-active {\n opacity: 1;\n transition: opacity 250ms ease-in;\n }\n\n .exit {\n opacity: 1;\n }\n\n .exit.exit-active {\n opacity: 0.01;\n transition: opacity 250ms ease-out;\n }\n" ]); ToastContainer_templateObject = function _templateObject() { return data; }; return data; } var ZINDEX = 1000; var TOP_POSITION = 80; // Initial position from the top var StyledToastContainer = styled_components_browser_esm/* default.div.withConfig */.ZP.div.withConfig({ componentId: "sc-2711bd7c-0" }).withConfig({ componentId: "sc-7a7c635d-0" })(ToastContainer_templateObject()); var ToastContainer = function ToastContainer(param) { var toasts = param.toasts, onRemove = param.onRemove, _ttl = param.ttl, ttl = _ttl === void 0 ? 6000 : _ttl, _stackSpacing = param.stackSpacing, stackSpacing = _stackSpacing === void 0 ? 24 : _stackSpacing; return /*#__PURE__*/ (0,jsx_runtime.jsx)(StyledToastContainer, { children: /*#__PURE__*/ (0,jsx_runtime.jsx)(esm_TransitionGroup, { children: toasts.map(function(toast, index) { var zIndex = (ZINDEX - index).toString(); var top = TOP_POSITION + index * stackSpacing; return /*#__PURE__*/ (0,jsx_runtime.jsx)(Toast, { toast: toast, onRemove: onRemove, ttl: ttl, style: { top: "".concat(top, "px"), zIndex: zIndex } }, toast.id); }) }) }); }; // EXTERNAL MODULE: ./packages/uikit/src/contexts/ToastsContext/useToast.ts var useToast = __webpack_require__(19237); ;// CONCATENATED MODULE: ./packages/uikit/src/contexts/ToastsContext/Listener.tsx var ToastListener = function ToastListener() { var ref = (0,useToast/* useToast */.p)(), toasts = ref.toasts, remove = ref.remove; var handleRemove = (0,react.useCallback)(function(id) { return remove(id); }, [ remove ]); return /*#__PURE__*/ (0,jsx_runtime.jsx)(ToastContainer, { toasts: toasts, onRemove: handleRemove }); }; /* harmony default export */ var Listener = (ToastListener); /***/ }), /***/ 31712: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "d": function() { return /* binding */ ToastsProvider; }, /* harmony export */ "i": function() { return /* binding */ ToastsContext; } /* harmony export */ }); /* harmony import */ var _swc_helpers_src_to_consumable_array_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(36305); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var lodash_kebabCase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(21804); /* harmony import */ var lodash_kebabCase__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_kebabCase__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var _components_Toast__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(47679); var ToastsContext = /*#__PURE__*/ (0,react__WEBPACK_IMPORTED_MODULE_1__.createContext)(undefined); var ToastsProvider = function ToastsProvider(param) { var children = param.children; var ref = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)([]), toasts = ref[0], setToasts = ref[1]; var toast = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function(param) { var title = param.title, description = param.description, type = param.type; setToasts(function(prevToasts) { var id = lodash_kebabCase__WEBPACK_IMPORTED_MODULE_2___default()(title); // Remove any existing toasts with the same id var currentToasts = prevToasts.filter(function(prevToast) { return prevToast.id !== id; }); return [ { id: id, title: title, description: description, type: type }, ].concat((0,_swc_helpers_src_to_consumable_array_mjs__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)(currentToasts)); }); }, [ setToasts ]); var toastError = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function(title, description) { return toast({ title: title, description: description, type: _components_Toast__WEBPACK_IMPORTED_MODULE_4__/* .types.DANGER */ .V.DANGER }); }, [ toast ]); var toastInfo = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function(title, description) { return toast({ title: title, description: description, type: _components_Toast__WEBPACK_IMPORTED_MODULE_4__/* .types.INFO */ .V.INFO }); }, [ toast ]); var toastSuccess = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function(title, description) { return toast({ title: title, description: description, type: _components_Toast__WEBPACK_IMPORTED_MODULE_4__/* .types.SUCCESS */ .V.SUCCESS }); }, [ toast ]); var toastWarning = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function(title, description) { return toast({ title: title, description: description, type: _components_Toast__WEBPACK_IMPORTED_MODULE_4__/* .types.WARNING */ .V.WARNING }); }, [ toast ]); var clear = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function() { return setToasts([]); }, []); var remove = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function(id) { setToasts(function(prevToasts) { return prevToasts.filter(function(prevToast) { return prevToast.id !== id; }); }); }, []); return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(ToastsContext.Provider, { value: { toasts: toasts, clear: clear, remove: remove, toastError: toastError, toastInfo: toastInfo, toastSuccess: toastSuccess, toastWarning: toastWarning }, children: children }); }; /***/ }), /***/ 19237: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "p": function() { return /* binding */ useToast; } /* harmony export */ }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(67294); /* harmony import */ var _Provider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31712); var useToast = function useToast() { var toastContext = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_Provider__WEBPACK_IMPORTED_MODULE_1__/* .ToastsContext */ .i); if (toastContext === undefined) { throw new Error("Toasts context undefined"); } return toastContext; }; /***/ }), /***/ 87613: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Y": function() { return /* binding */ useIsomorphicEffect; } /* harmony export */ }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(67294); var useIsomorphicEffect = false ? 0 : react__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect; /***/ }), /***/ 93788: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(67294); var useOnClickOutside = function useOnClickOutside(htmlNode, handler) { (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function() { if (htmlNode) { var listener = function listener(event) { // Do nothing if clicking ref's element or descendent elements if (htmlNode.contains(event.target)) { return; } handler(event); }; document.addEventListener("mousedown", listener); document.addEventListener("touchstart", listener); return function() { document.removeEventListener("mousedown", listener); document.removeEventListener("touchstart", listener); }; } return undefined; }, // ... function on every render that will cause this effect ... // ... callback/cleanup to run every render. It's not a big deal ... // ... but to optimize you can wrap handler in useCallback before ... // ... passing it into this hook. [ htmlNode, handler ]); }; /* harmony default export */ __webpack_exports__["Z"] = (useOnClickOutside); /***/ }), /***/ 88896: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { "Z": function() { return /* binding */ useTooltip_useTooltip; } }); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_instanceof.mjs var _instanceof = __webpack_require__(82670); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_spread.mjs var _object_spread = __webpack_require__(26042); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_spread_props.mjs var _object_spread_props = __webpack_require__(69396); // EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js var jsx_runtime = __webpack_require__(85893); // EXTERNAL MODULE: ./node_modules/framer-motion/dist/es/components/LazyMotion/index.mjs var LazyMotion = __webpack_require__(18522); // EXTERNAL MODULE: ./node_modules/framer-motion/dist/es/render/dom/features-animation.mjs + 27 modules var features_animation = __webpack_require__(55606); // EXTERNAL MODULE: ./node_modules/framer-motion/dist/es/components/AnimatePresence/index.mjs + 3 modules var AnimatePresence = __webpack_require__(21190); // EXTERNAL MODULE: ./node_modules/react/index.js var react = __webpack_require__(67294); // EXTERNAL MODULE: ./node_modules/react-dom/index.js var react_dom = __webpack_require__(73935); // EXTERNAL MODULE: ./node_modules/react-popper/lib/esm/usePopper.js + 53 modules var usePopper = __webpack_require__(66441); // EXTERNAL MODULE: ./node_modules/styled-components/dist/styled-components.browser.esm.js + 4 modules var styled_components_browser_esm = __webpack_require__(87379); // EXTERNAL MODULE: ./packages/uikit/src/theme/light.ts var light = __webpack_require__(99885); // EXTERNAL MODULE: ./packages/uikit/src/theme/dark.ts var dark = __webpack_require__(10494); // EXTERNAL MODULE: ./packages/uikit/src/util/getPortalRoot.ts var getPortalRoot = __webpack_require__(70032); // EXTERNAL MODULE: ./packages/uikit/src/util/isTouchDevice.ts var isTouchDevice = __webpack_require__(44047); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_tagged_template_literal.mjs var _tagged_template_literal = __webpack_require__(7297); // EXTERNAL MODULE: ./node_modules/framer-motion/dist/es/render/dom/motion-minimal.mjs + 23 modules var motion_minimal = __webpack_require__(45962); ;// CONCATENATED MODULE: ./packages/uikit/src/hooks/useTooltip/StyledTooltip.tsx function _templateObject() { var data = (0,_tagged_template_literal/* default */.Z)([ '\n &,\n &::before {\n position: absolute;\n width: 10px;\n height: 10px;\n border-radius: 2px;\n z-index: -1;\n }\n\n &::before {\n content: "";\n transform: rotate(45deg);\n background: ', ";\n }\n" ]); _templateObject = function _templateObject() { return data; }; return data; } function _templateObject1() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n padding: 16px;\n font-size: 16px;\n line-height: 130%;\n border-radius: 16px;\n max-width: 320px;\n z-index: 101;\n background: ", ";\n color: ", ";\n box-shadow: ", ';\n\n &[data-popper-placement^="top"] > ', ' {\n bottom: -4px;\n }\n\n &[data-popper-placement^="bottom"] > ', ' {\n top: -4px;\n }\n\n &[data-popper-placement^="left"] > ', ' {\n right: -4px;\n }\n\n &[data-popper-placement^="right"] > ', " {\n left: -4px;\n }\n" ]); _templateObject1 = function _templateObject1() { return data; }; return data; } var Arrow = styled_components_browser_esm/* default.div.withConfig */.ZP.div.withConfig({ componentId: "sc-3db373e4-0" }).withConfig({ componentId: "sc-178cc10c-0" })(_templateObject(), function(param) { var theme = param.theme; return theme.tooltip.background; }); var StyledTooltip = (0,styled_components_browser_esm/* default */.ZP)(motion_minimal.m.div).withConfig({ componentId: "sc-3db373e4-1" }).withConfig({ componentId: "sc-178cc10c-1" })(_templateObject1(), function(param) { var theme = param.theme; return theme.tooltip.background; }, function(param) { var theme = param.theme; return theme.tooltip.text; }, function(param) { var theme = param.theme; return theme.tooltip.boxShadow; }, Arrow, Arrow, Arrow, Arrow); ;// CONCATENATED MODULE: ./packages/uikit/src/hooks/useTooltip/useTooltip.tsx var animationVariants = { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 } }; var animationMap = { initial: "initial", animate: "animate", exit: "exit" }; var invertTheme = function invertTheme(currentTheme) { if (currentTheme.isDark) { return light/* default */.Z; } return dark/* default */.Z; }; var useTooltip = function useTooltip(content, options) { var _placement = options.placement, placement = _placement === void 0 ? "auto" : _placement, _trigger = options.trigger, trigger = _trigger === void 0 ? "hover" : _trigger, _arrowPadding = options.arrowPadding, arrowPadding = _arrowPadding === void 0 ? 16 : _arrowPadding, _tooltipPadding = options.tooltipPadding, tooltipPadding = _tooltipPadding === void 0 ? { left: 16, right: 16 } : _tooltipPadding, _tooltipOffset = options.tooltipOffset, tooltipOffset = _tooltipOffset === void 0 ? [ 0, 10 ] : _tooltipOffset, _hideTimeout = options.hideTimeout, hideTimeout = _hideTimeout === void 0 ? 100 : _hideTimeout; var ref = (0,react.useState)(null), targetElement = ref[0], setTargetElement = ref[1]; var ref1 = (0,react.useState)(null), tooltipElement = ref1[0], setTooltipElement = ref1[1]; var ref2 = (0,react.useState)(null), arrowElement = ref2[0], setArrowElement = ref2[1]; var ref3 = (0,react.useState)(false), visible = ref3[0], setVisible = ref3[1]; var isHoveringOverTooltip = (0,react.useRef)(false); var hideTimeoutRef = (0,react.useRef)(); var hideTooltip = (0,react.useCallback)(function(e) { var hide = function hide() { e.stopPropagation(); e.preventDefault(); setVisible(false); }; if (trigger === "hover") { if (hideTimeoutRef.current) { window.clearTimeout(hideTimeoutRef.current); } if (e.target === tooltipElement) { isHoveringOverTooltip.current = false; } if (!isHoveringOverTooltip.current) { hideTimeoutRef.current = window.setTimeout(function() { if (!isHoveringOverTooltip.current) { hide(); } }, hideTimeout); } } else { hide(); } }, [ tooltipElement, trigger, hideTimeout ]); var showTooltip = (0,react.useCallback)(function(e) { e.stopPropagation(); e.preventDefault(); setVisible(true); if (trigger === "hover") { if (e.target === targetElement) { // If we were about to close the tooltip and got back to it // then prevent closing it. clearTimeout(hideTimeoutRef.current); } if (e.target === tooltipElement) { isHoveringOverTooltip.current = true; } } }, [ tooltipElement, targetElement, trigger ]); var toggleTooltip = (0,react.useCallback)(function(e) { e.stopPropagation(); setVisible(!visible); }, [ visible ]); // Trigger = hover (0,react.useEffect)(function() { if (targetElement === null || trigger !== "hover") return undefined; if ((0,isTouchDevice/* default */.Z)()) { targetElement.addEventListener("touchstart", showTooltip); targetElement.addEventListener("touchend", hideTooltip); } else { targetElement.addEventListener("mouseenter", showTooltip); targetElement.addEventListener("mouseleave", hideTooltip); } return function() { targetElement.removeEventListener("touchstart", showTooltip); targetElement.removeEventListener("touchend", hideTooltip); targetElement.removeEventListener("mouseenter", showTooltip); targetElement.removeEventListener("mouseleave", showTooltip); }; }, [ trigger, targetElement, hideTooltip, showTooltip ]); // Keep tooltip open when cursor moves from the targetElement to the tooltip (0,react.useEffect)(function() { if (tooltipElement === null || trigger !== "hover") return undefined; tooltipElement.addEventListener("mouseenter", showTooltip); tooltipElement.addEventListener("mouseleave", hideTooltip); return function() { tooltipElement.removeEventListener("mouseenter", showTooltip); tooltipElement.removeEventListener("mouseleave", hideTooltip); }; }, [ trigger, tooltipElement, hideTooltip, showTooltip ]); // Trigger = click (0,react.useEffect)(function() { if (targetElement === null || trigger !== "click") return undefined; targetElement.addEventListener("click", toggleTooltip); return function() { return targetElement.removeEventListener("click", toggleTooltip); }; }, [ trigger, targetElement, visible, toggleTooltip ]); // Handle click outside (0,react.useEffect)(function() { if (trigger !== "click") return undefined; var handleClickOutside = function handleClickOutside(param) { var target = param.target; if ((0,_instanceof/* default */.Z)(target, Node)) { if (tooltipElement != null && targetElement != null && !tooltipElement.contains(target) && !targetElement.contains(target)) { setVisible(false); } } }; document.addEventListener("mousedown", handleClickOutside); return function() { return document.removeEventListener("mousedown", handleClickOutside); }; }, [ trigger, targetElement, tooltipElement ]); // Trigger = focus (0,react.useEffect)(function() { if (targetElement === null || trigger !== "focus") return undefined; targetElement.addEventListener("focus", showTooltip); targetElement.addEventListener("blur", hideTooltip); return function() { targetElement.removeEventListener("focus", showTooltip); targetElement.removeEventListener("blur", hideTooltip); }; }, [ trigger, targetElement, showTooltip, hideTooltip ]); // On small screens Popper.js tries to squeeze the tooltip to available space without overflowing beyond the edge // of the screen. While it works fine when the element is in the middle of the screen it does not handle well the // cases when the target element is very close to the edge of the screen - no margin is applied between the tooltip // and the screen edge. // preventOverflow mitigates this behaviour, default 16px paddings on left and right solve the problem for all screen sizes // that we support. // Note that in the farm page where there are tooltips very close to the edge of the screen this padding works perfectly // even on the iPhone 5 screen (320px wide), BUT in the storybook with the contrived example ScreenEdges example // iPhone 5 behaves differently overflowing beyond the edge. All paddings are identical so I have no idea why it is, // and fixing that seems like a very bad use of time. var ref4 = (0,usePopper/* usePopper */.D)(targetElement, tooltipElement, { placement: placement, modifiers: [ { name: "arrow", options: { element: arrowElement, padding: arrowPadding } }, { name: "offset", options: { offset: tooltipOffset } }, { name: "preventOverflow", options: { padding: tooltipPadding } }, ] }), styles = ref4.styles, attributes = ref4.attributes; var tooltip = /*#__PURE__*/ (0,jsx_runtime.jsxs)(StyledTooltip, (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)((0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({}, animationMap), { variants: animationVariants, transition: { duration: 0.3 }, ref: setTooltipElement, style: styles.popper }), attributes.popper), { children: [ /*#__PURE__*/ (0,jsx_runtime.jsx)(styled_components_browser_esm/* ThemeProvider */.f6, { theme: invertTheme, children: content }), /*#__PURE__*/ (0,jsx_runtime.jsx)(Arrow, { ref: setArrowElement, style: styles.arrow }) ] })); var AnimatedTooltip = /*#__PURE__*/ (0,jsx_runtime.jsx)(LazyMotion/* LazyMotion */.X, { features: features_animation/* domAnimation */.H, children: /*#__PURE__*/ (0,jsx_runtime.jsx)(AnimatePresence/* AnimatePresence */.M, { children: visible && tooltip }) }); var portal = (0,getPortalRoot/* default */.Z)(); var tooltipInPortal = portal ? /*#__PURE__*/ (0,react_dom.createPortal)(AnimatedTooltip, portal) : null; return { targetRef: setTargetElement, tooltip: tooltipInPortal !== null && tooltipInPortal !== void 0 ? tooltipInPortal : AnimatedTooltip, tooltipVisible: visible }; }; /* harmony default export */ var useTooltip_useTooltip = (useTooltip); /***/ }), /***/ 45009: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _pancakeswap_ui__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4857); /* harmony import */ var _pancakeswap_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(41727); /* harmony default export */ __webpack_exports__["Z"] = ({ siteWidth: 1200, breakpoints: Object.values(_pancakeswap_ui__WEBPACK_IMPORTED_MODULE_0__/* .breakpoints */ .AV).map(function(bp) { return "".concat(bp, "px"); }), mediaQueries: _pancakeswap_ui__WEBPACK_IMPORTED_MODULE_0__/* .mediaQueries */ .w5, spacing: _pancakeswap_ui__WEBPACK_IMPORTED_MODULE_1__/* .vars.space */ .g.space, shadows: _pancakeswap_ui__WEBPACK_IMPORTED_MODULE_1__/* .vars.shadows */ .g.shadows, radii: _pancakeswap_ui__WEBPACK_IMPORTED_MODULE_1__/* .vars.radii */ .g.radii, zIndices: { ribbon: 9, dropdown: 10, modal: 100 } }); /***/ }), /***/ 16557: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "C": function() { return /* binding */ lightColors; }, /* harmony export */ "_": function() { return /* binding */ darkColors; } /* harmony export */ }); /* harmony import */ var _pancakeswap_ui_css_vars_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(41727); var lightColors = _pancakeswap_ui_css_vars_css__WEBPACK_IMPORTED_MODULE_0__/* .vars.colors */ .g.colors; var darkColors = _pancakeswap_ui_css_vars_css__WEBPACK_IMPORTED_MODULE_0__/* .vars.colors */ .g.colors; /***/ }), /***/ 10494: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(69396); /* harmony import */ var _components_Alert_theme__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(52613); /* harmony import */ var _components_Card_theme__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(7270); /* harmony import */ var _components_PancakeToggle_theme__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(25746); /* harmony import */ var _components_Radio_theme__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(90501); /* harmony import */ var _components_Toggle_theme__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(96352); /* harmony import */ var _widgets_Menu_theme__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(2236); /* harmony import */ var _widgets_Modal_theme__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(28104); /* harmony import */ var _components_Tooltip_theme__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(38800); /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(45009); /* harmony import */ var _colors__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(16557); var darkTheme = (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)({}, _base__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z), { isDark: true, alert: _components_Alert_theme__WEBPACK_IMPORTED_MODULE_3__/* .dark */ ._, colors: _colors__WEBPACK_IMPORTED_MODULE_4__/* .darkColors */ ._, card: _components_Card_theme__WEBPACK_IMPORTED_MODULE_5__/* .dark */ ._, toggle: _components_Toggle_theme__WEBPACK_IMPORTED_MODULE_6__/* .dark */ ._, nav: _widgets_Menu_theme__WEBPACK_IMPORTED_MODULE_7__/* .dark */ ._, modal: _widgets_Modal_theme__WEBPACK_IMPORTED_MODULE_8__/* .dark */ ._, pancakeToggle: _components_PancakeToggle_theme__WEBPACK_IMPORTED_MODULE_9__/* .dark */ ._, radio: _components_Radio_theme__WEBPACK_IMPORTED_MODULE_10__/* .dark */ ._, tooltip: _components_Tooltip_theme__WEBPACK_IMPORTED_MODULE_11__/* .dark */ ._ }); /* harmony default export */ __webpack_exports__["Z"] = (darkTheme); /***/ }), /***/ 99885: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(69396); /* harmony import */ var _components_Alert_theme__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(52613); /* harmony import */ var _components_Card_theme__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(7270); /* harmony import */ var _components_PancakeToggle_theme__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(25746); /* harmony import */ var _components_Radio_theme__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(90501); /* harmony import */ var _components_Toggle_theme__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(96352); /* harmony import */ var _components_Tooltip_theme__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(38800); /* harmony import */ var _widgets_Menu_theme__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(2236); /* harmony import */ var _widgets_Modal_theme__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(28104); /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(45009); /* harmony import */ var _colors__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(16557); var lightTheme = (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)({}, _base__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z), { isDark: false, alert: _components_Alert_theme__WEBPACK_IMPORTED_MODULE_3__/* .light */ .R, colors: _colors__WEBPACK_IMPORTED_MODULE_4__/* .lightColors */ .C, card: _components_Card_theme__WEBPACK_IMPORTED_MODULE_5__/* .light */ .R, toggle: _components_Toggle_theme__WEBPACK_IMPORTED_MODULE_6__/* .light */ .R, nav: _widgets_Menu_theme__WEBPACK_IMPORTED_MODULE_7__/* .light */ .R, modal: _widgets_Modal_theme__WEBPACK_IMPORTED_MODULE_8__/* .light */ .R, pancakeToggle: _components_PancakeToggle_theme__WEBPACK_IMPORTED_MODULE_9__/* .light */ .R, radio: _components_Radio_theme__WEBPACK_IMPORTED_MODULE_10__/* .light */ .R, tooltip: _components_Tooltip_theme__WEBPACK_IMPORTED_MODULE_11__/* .light */ .R }); /* harmony default export */ __webpack_exports__["Z"] = (lightTheme); /***/ }), /***/ 37291: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "BI": function() { return /* binding */ animationHandler; }, /* harmony export */ "Gc": function() { return /* binding */ animationMap; }, /* harmony export */ "Oz": function() { return /* binding */ appearAnimation; }, /* harmony export */ "a4": function() { return /* binding */ disappearAnimation; }, /* harmony export */ "ji": function() { return /* binding */ animationVariants; } /* harmony export */ }); /* harmony import */ var _swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7297); /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(87379); function _templateObject() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n from { opacity:0 }\n to { opacity:1 }\n" ]); _templateObject = function _templateObject() { return data; }; return data; } function _templateObject1() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n from { opacity:1 }\n to { opacity:0 }\n" ]); _templateObject1 = function _templateObject1() { return data; }; return data; } var appearAnimation = (0,styled_components__WEBPACK_IMPORTED_MODULE_1__/* .keyframes */ .F4)(_templateObject()); var disappearAnimation = (0,styled_components__WEBPACK_IMPORTED_MODULE_1__/* .keyframes */ .F4)(_templateObject1()); var animationHandler = function animationHandler(element) { if (!element) return; if (element.classList.contains("appear")) { element.classList.remove("appear"); element.classList.add("disappear"); } else { element.classList.remove("disappear"); element.classList.add("appear"); } }; var animationVariants = { initial: { transform: "translateX(0px)" }, animate: { transform: "translateX(0px)" }, exit: { transform: "translateX(0px)" } }; var animationMap = { initial: "initial", animate: "animate", exit: "exit" }; /***/ }), /***/ 21777: /***/ (function(__unused_webpack_module, __webpack_exports__) { "use strict"; var EXTERNAL_LINK_PROPS = { target: "_blank", rel: "noreferrer noopener" }; /* harmony default export */ __webpack_exports__["Z"] = (EXTERNAL_LINK_PROPS); /***/ }), /***/ 70032: /***/ (function(__unused_webpack_module, __webpack_exports__) { "use strict"; // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types var ref; var getPortalRoot = function getPortalRoot() { return true && ((ref = document.getElementById("portal-root")) !== null && ref !== void 0 ? ref : document.body); }; /* harmony default export */ __webpack_exports__["Z"] = (getPortalRoot); /***/ }), /***/ 1983: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var lodash_get__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27361); /* harmony import */ var lodash_get__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_get__WEBPACK_IMPORTED_MODULE_0__); var getThemeValue = function getThemeValue(theme, path, fallback) { return lodash_get__WEBPACK_IMPORTED_MODULE_0___default()(theme, path, fallback); }; /* harmony default export */ __webpack_exports__["Z"] = (getThemeValue); /***/ }), /***/ 44047: /***/ (function(__unused_webpack_module, __webpack_exports__) { "use strict"; var isTouchDevice = function isTouchDevice() { return true && ("ontouchstart" in window || navigator.maxTouchPoints > 0 || // @ts-ignore navigator.msMaxTouchPoints > 0); }; /* harmony default export */ __webpack_exports__["Z"] = (isTouchDevice); /***/ }), /***/ 47877: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { "Z": function() { return /* binding */ Menu_Menu; } }); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_tagged_template_literal.mjs var _tagged_template_literal = __webpack_require__(7297); // EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js var jsx_runtime = __webpack_require__(85893); // EXTERNAL MODULE: ./node_modules/lodash/throttle.js var throttle = __webpack_require__(23493); var throttle_default = /*#__PURE__*/__webpack_require__.n(throttle); // EXTERNAL MODULE: ./node_modules/react/index.js var react = __webpack_require__(67294); // EXTERNAL MODULE: ./node_modules/styled-components/dist/styled-components.browser.esm.js + 4 modules var styled_components_browser_esm = __webpack_require__(87379); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_spread.mjs var _object_spread = __webpack_require__(26042); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_spread_props.mjs var _object_spread_props = __webpack_require__(69396); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_without_properties.mjs + 1 modules var _object_without_properties = __webpack_require__(99534); // EXTERNAL MODULE: ./packages/uikit/src/widgets/Menu/context.ts var context = __webpack_require__(63524); // EXTERNAL MODULE: ./packages/uikit/src/components/Box/Flex.tsx var Flex = __webpack_require__(75943); ;// CONCATENATED MODULE: ./packages/uikit/src/components/Svg/styles.tsx function _templateObject() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n background: ", ";\n" ]); _templateObject = function _templateObject() { return data; }; return data; } function _templateObject1() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n position: relative;\n ", ";\n ", ";\n\n div:first-child {\n ", ";\n ", ";\n z-index: 0;\n }\n ", "\n\n ", "\n" ]); _templateObject1 = function _templateObject1() { return data; }; return data; } var StyledIconContainer = styled_components_browser_esm/* default.div.withConfig */.ZP.div.withConfig({ componentId: "sc-bfd9d551-0" }).withConfig({ componentId: "sc-1057f0c5-0" })(_templateObject(), function(param) { var activeBackgroundColor = param.activeBackgroundColor, theme = param.theme; return activeBackgroundColor ? theme.colors[activeBackgroundColor] : "transparent"; }); var StyledAnimatedIconComponent = styled_components_browser_esm/* default.div.withConfig */.ZP.div.withConfig({ componentId: "sc-bfd9d551-1" }).withConfig({ componentId: "sc-1057f0c5-1" })(_templateObject1(), function(param) { var height = param.height; return height && "height: ".concat(height); }, function(param) { var width = param.width; return "width: ".concat(width || "100%"); }, function(param) { var height = param.height; return height && "height: ".concat(height); }, function(param) { var width = param.width; return "width: ".concat(width || "100%"); }, function(param) { var hasFillIcon = param.hasFillIcon; return hasFillIcon && "\n div, svg {\n position: absolute;\n left: 0;\n bottom: 0;\n overflow:hidden;\n }\n\n div:last-child {\n height: 0;\n z-index: 5;\n transition: height 0.25s ease;\n }\n "; }, function(param) { var isActive = param.isActive, height = param.height, width = param.width, hasFillIcon = param.hasFillIcon; return isActive && "\n div:last-child {\n ".concat(height && hasFillIcon && "height:".concat(height), ";\n ").concat("width: ".concat(width || "100%"), ";\n }\n "); }); ;// CONCATENATED MODULE: ./packages/uikit/src/components/Svg/AnimatedIconComponent.tsx var AnimatedIconComponent = function AnimatedIconComponent(_param) { var icon = _param.icon, fillIcon = _param.fillIcon, _color = _param.color, color = _color === void 0 ? "textSubtle" : _color, _activeColor = _param.activeColor, activeColor = _activeColor === void 0 ? "secondary" : _activeColor, activeBackgroundColor = _param.activeBackgroundColor, _isActive = _param.isActive, isActive = _isActive === void 0 ? false : _isActive, props = (0,_object_without_properties/* default */.Z)(_param, [ "icon", "fillIcon", "color", "activeColor", "activeBackgroundColor", "isActive" ]); var IconElement = icon; var IconElementFill = fillIcon; return IconElement ? /*#__PURE__*/ (0,jsx_runtime.jsxs)(StyledAnimatedIconComponent, (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({ isActive: isActive, hasFillIcon: !!IconElementFill }, props), { children: [ /*#__PURE__*/ (0,jsx_runtime.jsx)(StyledIconContainer, { activeBackgroundColor: activeBackgroundColor, children: /*#__PURE__*/ (0,jsx_runtime.jsx)(IconElement, { color: color }) }), !!IconElementFill && /*#__PURE__*/ (0,jsx_runtime.jsx)(StyledIconContainer, (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({ activeBackgroundColor: activeBackgroundColor }, props), { children: /*#__PURE__*/ (0,jsx_runtime.jsx)(IconElementFill, { color: activeColor }) })) ] })) : null; }; /* harmony default export */ var Svg_AnimatedIconComponent = (AnimatedIconComponent); // EXTERNAL MODULE: ./packages/uikit/src/components/Text/Text.tsx var Text = __webpack_require__(62077); ;// CONCATENATED MODULE: ./packages/uikit/src/components/BottomNavItem/styles.tsx function styles_templateObject() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n display: block;\n border: 0;\n background: transparent;\n cursor: pointer;\n height: 44px;\n padding: 4px 12px;\n &:hover {\n border-radius: 16px;\n }\n &:hover,\n &:hover div {\n background: ", ";\n }\n" ]); styles_templateObject = function _templateObject() { return data; }; return data; } function styles_templateObject1() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n display: -webkit-box;\n overflow: hidden;\n user-select: none;\n -webkit-line-clamp: 1;\n -webkit-box-orient: vertical;\n -webkit-user-select: none;\n -webkit-touch-callout: none;\n" ]); styles_templateObject1 = function _templateObject1() { return data; }; return data; } var StyledBottomNavItem = styled_components_browser_esm/* default.button.withConfig */.ZP.button.withConfig({ componentId: "sc-7b8c54f4-0" }).withConfig({ componentId: "sc-444841-0" })(styles_templateObject(), function(param) { var theme = param.theme; return theme.colors.tertiary; }); var StyledBottomNavText = (0,styled_components_browser_esm/* default */.ZP)(Text/* default */.Z).withConfig({ componentId: "sc-7b8c54f4-1" }).withConfig({ componentId: "sc-444841-1" })(styles_templateObject1()); ;// CONCATENATED MODULE: ./packages/uikit/src/components/BottomNavItem/BottomNavItem.tsx var BottomNavItem = function BottomNavItem(_param) { var label = _param.label, icon = _param.icon, fillIcon = _param.fillIcon, href = _param.href, _showItemsOnMobile = _param.showItemsOnMobile, showItemsOnMobile = _showItemsOnMobile === void 0 ? false : _showItemsOnMobile, _isActive = _param.isActive, isActive = _isActive === void 0 ? false : _isActive, _disabled = _param.disabled, disabled = _disabled === void 0 ? false : _disabled, props = (0,_object_without_properties/* default */.Z)(_param, [ "label", "icon", "fillIcon", "href", "showItemsOnMobile", "isActive", "disabled" ]); var linkComponent = (0,react.useContext)(context/* MenuContext */.p).linkComponent; var bottomNavItemContent = /*#__PURE__*/ (0,jsx_runtime.jsxs)(Flex/* default */.Z, { flexDirection: "column", justifyContent: "center", alignItems: "center", height: "100%", children: [ icon && /*#__PURE__*/ (0,jsx_runtime.jsx)(Svg_AnimatedIconComponent, { icon: icon, fillIcon: fillIcon, height: "22px", width: "21px", color: isActive ? "secondary" : "textSubtle", isActive: isActive, activeBackgroundColor: "backgroundAlt" }), /*#__PURE__*/ (0,jsx_runtime.jsx)(StyledBottomNavText, { color: isActive ? "text" : "textSubtle", fontWeight: isActive ? "600" : "400", fontSize: "10px", children: label }) ] }); return showItemsOnMobile ? /*#__PURE__*/ (0,jsx_runtime.jsx)(StyledBottomNavItem, (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({ style: { opacity: disabled ? 0.5 : 1 }, type: "button" }, props), { children: bottomNavItemContent })) : /*#__PURE__*/ (0,jsx_runtime.jsx)(StyledBottomNavItem, (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({ style: { opacity: disabled ? 0.5 : 1 }, as: linkComponent, href: href }, props), { children: bottomNavItemContent })); }; /* harmony default export */ var BottomNavItem_BottomNavItem = (BottomNavItem); ;// CONCATENATED MODULE: ./packages/uikit/src/components/BottomNav/styles.tsx function BottomNav_styles_templateObject() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n position: fixed;\n bottom: 0px;\n width: 100%;\n padding: 5px 8px;\n background: ", ";\n border-top: 1px solid ", ';\n padding-bottom: env(safe-area-inset-bottom);\n html[data-useragent*="TokenPocket_iOS"] & {\n padding-bottom: 45px;\n }\n z-index: 20;\n' ]); BottomNav_styles_templateObject = function _templateObject() { return data; }; return data; } var StyledBottomNav = (0,styled_components_browser_esm/* default */.ZP)(Flex/* default */.Z).withConfig({ componentId: "sc-760c5199-0" }).withConfig({ componentId: "sc-1b0f039e-0" })(BottomNav_styles_templateObject(), function(param) { var theme = param.theme; return theme.colors.backgroundAlt; }, function(param) { var theme = param.theme; return theme.colors.cardBorder; }); /* harmony default export */ var styles = (StyledBottomNav); // EXTERNAL MODULE: ./packages/uikit/src/components/Box/Box.tsx var Box = __webpack_require__(44147); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_define_property.mjs var _define_property = __webpack_require__(14924); // EXTERNAL MODULE: ./node_modules/react-popper/lib/esm/usePopper.js + 53 modules var usePopper = __webpack_require__(66441); // EXTERNAL MODULE: ./packages/uikit/src/hooks/useOnClickOutside.ts var useOnClickOutside = __webpack_require__(93788); // EXTERNAL MODULE: ./packages/uikit/src/components/Svg/Icons/Logout.tsx var Logout = __webpack_require__(55036); ;// CONCATENATED MODULE: ./packages/uikit/src/components/DropdownMenu/styles.tsx function DropdownMenu_styles_templateObject() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n align-items: center;\n border: 0;\n background: transparent;\n color: ", ";\n cursor: pointer;\n font-weight: ", ";\n display: flex;\n font-size: 16px;\n height: 48px;\n justify-content: space-between;\n outline: 0;\n padding-left: 16px;\n padding-right: 16px;\n width: 100%;\n\n &:is(button) {\n cursor: ", ";\n }\n\n &:hover:not(:disabled) {\n background-color: ", ";\n }\n\n &:active:not(:disabled) {\n opacity: 0.85;\n transform: translateY(1px);\n }\n" ]); DropdownMenu_styles_templateObject = function _templateObject() { return data; }; return data; } function DropdownMenu_styles_templateObject1() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n &:first-child > ", " {\n border-top-left-radius: 8px;\n border-top-right-radius: 8px;\n }\n\n &:last-child > ", " {\n border-bottom-left-radius: 8px;\n border-bottom-right-radius: 8px;\n }\n" ]); DropdownMenu_styles_templateObject1 = function _templateObject1() { return data; }; return data; } function _templateObject2() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n border-color: ", ";\n border-style: solid;\n border-width: 1px 0 0;\n margin: 4px 0;\n" ]); _templateObject2 = function _templateObject2() { return data; }; return data; } function _templateObject3() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: 16px;\n padding-bottom: 4px;\n padding-top: 4px;\n pointer-events: auto;\n margin-bottom: 0;\n width: ", ";\n visibility: visible;\n z-index: 1001;\n\n ", "\n" ]); _templateObject3 = function _templateObject3() { return data; }; return data; } function _templateObject4() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n border-radius: ", ";\n padding: 0 8px;\n border: 2px solid;\n border-color: ", ";\n box-shadow: none;\n color: ", ";\n margin-left: 8px;\n" ]); _templateObject4 = function _templateObject4() { return data; }; return data; } var getTextColor = function getTextColor(param) { var $isActive = param.$isActive, disabled = param.disabled, theme = param.theme; if (disabled) return theme.colors.textDisabled; if ($isActive) return theme.colors.secondary; return theme.colors.textSubtle; }; var DropdownMenuItem = styled_components_browser_esm/* default.button.withConfig */.ZP.button.withConfig({ componentId: "sc-c11809c1-0" }).withConfig({ componentId: "sc-5474d398-0" })(DropdownMenu_styles_templateObject(), function(param) { var theme = param.theme, disabled = param.disabled, $isActive = param.$isActive; return getTextColor({ theme: theme, disabled: disabled, $isActive: $isActive }); }, function(param) { var _$isActive = param.$isActive, $isActive = _$isActive === void 0 ? false : _$isActive; return $isActive ? "600" : "400"; }, function(param) { var disabled = param.disabled; return disabled ? "not-allowed" : "pointer"; }, function(param) { var theme = param.theme; return theme.colors.tertiary; }); var StyledDropdownMenuItemContainer = styled_components_browser_esm/* default.div.withConfig */.ZP.div.withConfig({ componentId: "sc-c11809c1-1" }).withConfig({ componentId: "sc-5474d398-1" })(DropdownMenu_styles_templateObject1(), DropdownMenuItem, DropdownMenuItem); var DropdownMenuDivider = styled_components_browser_esm/* default.hr.withConfig */.ZP.hr.withConfig({ componentId: "sc-c11809c1-2" }).withConfig({ componentId: "sc-5474d398-2" })(_templateObject2(), function(param) { var theme = param.theme; return theme.colors.cardBorder; }); var StyledDropdownMenu = styled_components_browser_esm/* default.div.withConfig */.ZP.div.withConfig({ componentId: "sc-c11809c1-3" }).withConfig({ componentId: "sc-5474d398-3" })(_templateObject3(), function(param) { var theme = param.theme; return theme.card.background; }, function(param) { var theme = param.theme; return theme.colors.cardBorder; }, function(param) { var $isBottomNav = param.$isBottomNav; return $isBottomNav ? "calc(100% - 32px)" : "280px"; }, function(param) { var $isOpen = param.$isOpen; return !$isOpen && "\n pointer-events: none;\n visibility: hidden;\n "; }); var LinkStatus = (0,styled_components_browser_esm/* default */.ZP)(Text/* default */.Z).withConfig({ componentId: "sc-c11809c1-4" }).withConfig({ componentId: "sc-5474d398-4" })(_templateObject4(), function(param) { var theme = param.theme; return theme.radii.default; }, function(param) { var theme = param.theme, color = param.color; return theme.colors[color]; }, function(param) { var theme = param.theme, color = param.color; return theme.colors[color]; }); // EXTERNAL MODULE: ./packages/uikit/src/components/DropdownMenu/types.ts var types = __webpack_require__(78242); ;// CONCATENATED MODULE: ./packages/uikit/src/components/DropdownMenu/DropdownMenu.tsx /* eslint-disable react/no-array-index-key */ var DropdownMenu = function DropdownMenu(_param) { var children = _param.children, _isBottomNav = _param.isBottomNav, isBottomNav = _isBottomNav === void 0 ? false : _isBottomNav, _showItemsOnMobile = _param.showItemsOnMobile, showItemsOnMobile = _showItemsOnMobile === void 0 ? false : _showItemsOnMobile, _activeItem = _param.activeItem, activeItem = _activeItem === void 0 ? "" : _activeItem, _items = _param.items, items = _items === void 0 ? [] : _items, index = _param.index, setMenuOpenByIndex = _param.setMenuOpenByIndex, isDisabled = _param.isDisabled, props = (0,_object_without_properties/* default */.Z)(_param, [ "children", "isBottomNav", "showItemsOnMobile", "activeItem", "items", "index", "setMenuOpenByIndex", "isDisabled" ]); var linkComponent = (0,react.useContext)(context/* MenuContext */.p).linkComponent; var ref = (0,react.useState)(false), isOpen = ref[0], setIsOpen = ref[1]; var ref1 = (0,react.useState)(null), targetRef = ref1[0], setTargetRef = ref1[1]; var ref2 = (0,react.useState)(null), tooltipRef = ref2[0], setTooltipRef = ref2[1]; var hasItems = items.length > 0; var ref3 = (0,usePopper/* usePopper */.D)(targetRef, tooltipRef, { strategy: isBottomNav ? "absolute" : "fixed", placement: isBottomNav ? "top" : "bottom-start", modifiers: [ { name: "offset", options: { offset: [ 0, isBottomNav ? 6 : 0 ] } } ] }), styles = ref3.styles, attributes = ref3.attributes; var isMenuShow = isOpen && (isBottomNav && showItemsOnMobile || !isBottomNav); (0,react.useEffect)(function() { var showDropdownMenu = function showDropdownMenu() { setIsOpen(true); }; var hideDropdownMenu = function hideDropdownMenu(evt) { var target = evt.target; return target && !(tooltipRef === null || tooltipRef === void 0 ? void 0 : tooltipRef.contains(target)) && setIsOpen(false); }; targetRef === null || targetRef === void 0 ? void 0 : targetRef.addEventListener("mouseenter", showDropdownMenu); targetRef === null || targetRef === void 0 ? void 0 : targetRef.addEventListener("mouseleave", hideDropdownMenu); return function() { targetRef === null || targetRef === void 0 ? void 0 : targetRef.removeEventListener("mouseenter", showDropdownMenu); targetRef === null || targetRef === void 0 ? void 0 : targetRef.removeEventListener("mouseleave", hideDropdownMenu); }; }, [ targetRef, tooltipRef, setIsOpen, isBottomNav ]); (0,react.useEffect)(function() { if (setMenuOpenByIndex && index !== undefined) { setMenuOpenByIndex(function(prevValue) { return (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({}, prevValue), (0,_define_property/* default */.Z)({}, index, isMenuShow)); }); } }, [ isMenuShow, setMenuOpenByIndex, index ]); (0,useOnClickOutside/* default */.Z)(targetRef, (0,react.useCallback)(function() { setIsOpen(false); }, [ setIsOpen ])); return /*#__PURE__*/ (0,jsx_runtime.jsxs)(Box/* default */.Z, (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({ ref: setTargetRef }, props), { children: [ /*#__PURE__*/ (0,jsx_runtime.jsx)(Box/* default */.Z, { onPointerDown: function onPointerDown() { setIsOpen(function(s) { return !s; }); }, children: children }), hasItems && /*#__PURE__*/ (0,jsx_runtime.jsx)(StyledDropdownMenu, (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({ style: styles.popper, ref: setTooltipRef }, attributes.popper), { $isBottomNav: isBottomNav, $isOpen: isMenuShow, children: items.filter(function(item) { return !item.isMobileOnly; }).map(function(_param, itemItem) { var _type = _param.type, type = _type === void 0 ? types/* DropdownMenuItemType.INTERNAL_LINK */.l.INTERNAL_LINK : _type, label = _param.label, _href = _param.href, href = _href === void 0 ? "/" : _href, status = _param.status, disabled = _param.disabled, itemProps = (0,_object_without_properties/* default */.Z)(_param, [ "type", "label", "href", "status", "disabled" ]); var MenuItemContent = /*#__PURE__*/ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, { children: [ label, status && /*#__PURE__*/ (0,jsx_runtime.jsx)(LinkStatus, { color: status.color, fontSize: "14px", children: status.text }) ] }); var isActive = href === activeItem; return /*#__PURE__*/ (0,jsx_runtime.jsxs)(StyledDropdownMenuItemContainer, { children: [ type === types/* DropdownMenuItemType.BUTTON */.l.BUTTON && /*#__PURE__*/ (0,jsx_runtime.jsx)(DropdownMenuItem, (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({ $isActive: isActive, disabled: disabled || isDisabled, type: "button" }, itemProps), { children: MenuItemContent })), type === types/* DropdownMenuItemType.INTERNAL_LINK */.l.INTERNAL_LINK && /*#__PURE__*/ (0,jsx_runtime.jsx)(DropdownMenuItem, (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({ $isActive: isActive, disabled: disabled || isDisabled, as: linkComponent, href: href, onClick: function onClick() { setIsOpen(false); } }, itemProps), { children: MenuItemContent })), type === types/* DropdownMenuItemType.EXTERNAL_LINK */.l.EXTERNAL_LINK && /*#__PURE__*/ (0,jsx_runtime.jsx)(DropdownMenuItem, (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({ $isActive: isActive, disabled: disabled || isDisabled, as: "a", href: href, target: "_blank", onClick: function onClick() { setIsOpen(false); } }, itemProps), { children: /*#__PURE__*/ (0,jsx_runtime.jsxs)(Flex/* default */.Z, { alignItems: "center", justifyContent: "space-between", width: "100%", children: [ label, /*#__PURE__*/ (0,jsx_runtime.jsx)(Logout/* default */.Z, {}) ] }) })), type === types/* DropdownMenuItemType.DIVIDER */.l.DIVIDER && /*#__PURE__*/ (0,jsx_runtime.jsx)(DropdownMenuDivider, {}) ] }, itemItem); }) })) ] })); }; /* harmony default export */ var DropdownMenu_DropdownMenu = (DropdownMenu); // EXTERNAL MODULE: ./packages/uikit/src/components/NotificationDot/NotificationDot.tsx var NotificationDot = __webpack_require__(85765); // EXTERNAL MODULE: ./packages/uikit/src/components/Overlay/Overlay.tsx var Overlay = __webpack_require__(72881); ;// CONCATENATED MODULE: ./packages/uikit/src/components/BottomNav/BottomNav.tsx var BottomNav = function BottomNav(_param) { var _items = _param.items, items = _items === void 0 ? [] : _items, _activeItem = _param.activeItem, activeItem = _activeItem === void 0 ? "" : _activeItem, _activeSubItem = _param.activeSubItem, activeSubItem = _activeSubItem === void 0 ? "" : _activeSubItem, props = (0,_object_without_properties/* default */.Z)(_param, [ "items", "activeItem", "activeSubItem" ]); var ref = (0,react.useState)({}), menuOpenByIndex = ref[0], setMenuOpenByIndex = ref[1]; var isBottomMenuOpen = Object.values(menuOpenByIndex).some(function(acc) { return acc; }); return /*#__PURE__*/ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, { children: [ isBottomMenuOpen && /*#__PURE__*/ (0,jsx_runtime.jsx)(Overlay/* default */.Z, {}), /*#__PURE__*/ (0,jsx_runtime.jsx)(styles, (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({ justifyContent: "space-around" }, props), { children: items.map(function(param, index) { var label = param.label, menuItems = param.items, href = param.href, icon = param.icon, fillIcon = param.fillIcon, _showOnMobile = param.showOnMobile, showOnMobile = _showOnMobile === void 0 ? true : _showOnMobile, _showItemsOnMobile = param.showItemsOnMobile, showItemsOnMobile = _showItemsOnMobile === void 0 ? true : _showItemsOnMobile, disabled = param.disabled; var ref, ref1; var statusColor = (ref = menuItems === null || menuItems === void 0 ? void 0 : menuItems.find(function(menuItem) { return menuItem.status !== undefined; })) === null || ref === void 0 ? void 0 : (ref1 = ref.status) === null || ref1 === void 0 ? void 0 : ref1.color; return showOnMobile && /*#__PURE__*/ (0,jsx_runtime.jsx)(DropdownMenu_DropdownMenu, { items: menuItems, isBottomNav: true, activeItem: activeSubItem, showItemsOnMobile: showItemsOnMobile, setMenuOpenByIndex: setMenuOpenByIndex, index: index, isDisabled: disabled, children: /*#__PURE__*/ (0,jsx_runtime.jsx)(Box/* default */.Z, { children: /*#__PURE__*/ (0,jsx_runtime.jsx)(NotificationDot/* default */.Z, { show: !!statusColor, color: statusColor, children: /*#__PURE__*/ (0,jsx_runtime.jsx)(BottomNavItem_BottomNavItem, { href: href, disabled: disabled, isActive: href === activeItem, label: label, icon: icon, fillIcon: fillIcon, showItemsOnMobile: showItemsOnMobile }) }) }) }, "".concat(label, "#").concat(href)); }) })) ] }); }; /* harmony default export */ var BottomNav_BottomNav = (/*#__PURE__*/(0,react.memo)(BottomNav)); // EXTERNAL MODULE: ./packages/uikit/src/theme/colors.ts var colors = __webpack_require__(16557); ;// CONCATENATED MODULE: ./node_modules/@swc/helpers/src/_extends.mjs function extends_() { extends_ = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return extends_.apply(this, arguments); } function _extends() { return extends_.apply(this, arguments); } // EXTERNAL MODULE: ./packages/uikit/src/components/Link/Link.tsx var Link = __webpack_require__(98768); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_to_consumable_array.mjs + 2 modules var _to_consumable_array = __webpack_require__(36305); // EXTERNAL MODULE: ./packages/uikit/src/components/Svg/Icons/Twitter.tsx var Twitter = __webpack_require__(74167); // EXTERNAL MODULE: ./packages/uikit/src/components/Svg/Icons/Telegram.tsx var Telegram = __webpack_require__(38514); // EXTERNAL MODULE: ./packages/uikit/src/components/Svg/Icons/Discord.tsx var Discord = __webpack_require__(8221); ;// CONCATENATED MODULE: ./packages/uikit/src/components/Footer/config.tsx var footerLinks = [ { label: "About", items: [ { label: "Contact", href: "https://docs.pancakeswap.finance/contact-us" }, { label: "Blog", href: "https://medium.com/pancakeswap" }, { label: "Community", href: "https://docs.pancakeswap.finance/contact-us/telegram" }, { label: "CAKE", href: "https://docs.pancakeswap.finance/tokenomics/cake" }, { label: "—" }, { label: "Online Store", href: "https://pancakeswap.creator-spring.com/", isHighlighted: true }, ] }, { label: "Help", items: [ { label: "Customer", href: "Support https://docs.pancakeswap.finance/contact-us/customer-support" }, { label: "Troubleshooting", href: "https://docs.pancakeswap.finance/help/troubleshooting" }, { label: "Guides", href: "https://docs.pancakeswap.finance/get-started" }, ] }, { label: "Developers", items: [ { label: "Github", href: "https://github.com/pancakeswap" }, { label: "Documentation", href: "https://docs.pancakeswap.finance" }, { label: "Bug Bounty", href: "https://app.gitbook.com/@pancakeswap-1/s/pancakeswap/code/bug-bounty" }, { label: "Audits", href: "https://docs.pancakeswap.finance/help/faq#is-pancakeswap-safe-has-pancakeswap-been-audited" }, { label: "Careers", href: "https://docs.pancakeswap.finance/hiring/become-a-chef" }, ] }, ]; var socials = [ { label: "Twitter", icon: Twitter/* default */.Z, href: "https://twitter.com/TrollCoinCro" }, { label: "Telegram", icon: Telegram/* default */.Z, href: "https://t.me/OfficialTrollcoin" }, // { // label: "Reddit", // icon: RedditIcon, // href: "https://reddit.com/r/pancakeswap", // }, // { // label: "Instagram", // icon: InstagramIcon, // href: "https://instagram.com/pancakeswap_official", // }, // { // label: "Github", // icon: GithubIcon, // href: "https://github.com/pancakeswap/", // }, { label: "Discord", icon: Discord/* default */.Z, href: "https://discord.gg/trollcoin" }, ]; var langs = (0,_to_consumable_array/* default */.Z)(Array(20)).map(function(_, i) { return { code: "en".concat(i), language: "English".concat(i), locale: "Locale".concat(i) }; }); ;// CONCATENATED MODULE: ./packages/uikit/src/components/Footer/Components/SocialLinks.tsx var SocialLinks = function SocialLinks(_param) /*#__PURE__*/ { var props = _extends({}, _param); return (0,jsx_runtime.jsx)(Flex/* default */.Z, (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({}, props), { "data-theme": "dark", children: socials.map(function(social, index) { var iconProps = { width: "20px", color: "textSubtle", style: { cursor: "pointer" } }; var Icon = social.icon; var mr = index < socials.length - 1 ? "24px" : 0; return /*#__PURE__*/ (0,jsx_runtime.jsx)(Link/* default */.Z, { external: true, href: social.href, "aria-label": social.label, mr: mr, children: /*#__PURE__*/ (0,jsx_runtime.jsx)(Icon, (0,_object_spread/* default */.Z)({}, iconProps)) }, social.label); }) })); }; /* harmony default export */ var Components_SocialLinks = (/*#__PURE__*/react.memo(SocialLinks, function() { return true; })); ;// CONCATENATED MODULE: ./packages/uikit/src/components/Footer/styles.tsx function Footer_styles_templateObject() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n background: ", ";\n" ]); Footer_styles_templateObject = function _templateObject() { return data; }; return data; } function Footer_styles_templateObject1() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n list-style: none;\n\n ", " {\n margin-bottom: 0px;\n }\n" ]); Footer_styles_templateObject1 = function _templateObject1() { return data; }; return data; } function styles_templateObject2() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n font-size: 16px;\n text-transform: capitalize;\n\n &:first-child {\n color: ", ";\n font-weight: 600;\n text-transform: uppercase;\n }\n" ]); styles_templateObject2 = function _templateObject2() { return data; }; return data; } function styles_templateObject3() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n margin-bottom: 24px;\n" ]); styles_templateObject3 = function _templateObject3() { return data; }; return data; } function styles_templateObject4() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n padding: 24px 0;\n margin-bottom: 0px;\n\n ", " {\n border-top-width: 0;\n border-bottom-width: 0;\n padding: 0 0;\n margin-bottom: 0;\n }\n" ]); styles_templateObject4 = function _templateObject4() { return data; }; return data; } function _templateObject5() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n border-bottom: 0px solid ", ";\n" ]); _templateObject5 = function _templateObject5() { return data; }; return data; } function _templateObject6() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n color: ", ";\n" ]); _templateObject6 = function _templateObject6() { return data; }; return data; } var StyledFooter = (0,styled_components_browser_esm/* default */.ZP)(Flex/* default */.Z).withConfig({ componentId: "sc-5a1ba595-0" }).withConfig({ componentId: "sc-821ea00c-0" })(Footer_styles_templateObject(), colors/* darkColors.backgroundAlt */._.backgroundAlt); var StyledList = styled_components_browser_esm/* default.ul.withConfig */.ZP.ul.withConfig({ componentId: "sc-5a1ba595-1" }).withConfig({ componentId: "sc-821ea00c-1" })(Footer_styles_templateObject1(), function(param) { var theme = param.theme; return theme.mediaQueries.md; }); var StyledListItem = styled_components_browser_esm/* default.li.withConfig */.ZP.li.withConfig({ componentId: "sc-5a1ba595-2" }).withConfig({ componentId: "sc-821ea00c-2" })(styles_templateObject2(), colors/* darkColors.secondary */._.secondary); var StyledIconMobileContainer = (0,styled_components_browser_esm/* default */.ZP)(Box/* default */.Z).withConfig({ componentId: "sc-5a1ba595-3" }).withConfig({ componentId: "sc-821ea00c-3" })(styles_templateObject3()); var StyledToolsContainer = (0,styled_components_browser_esm/* default */.ZP)(Flex/* default */.Z).withConfig({ componentId: "sc-5a1ba595-4" }).withConfig({ componentId: "sc-821ea00c-4" })(styles_templateObject4(), function(param) { var theme = param.theme; return theme.mediaQueries.sm; }); var StyledSocialLinks = (0,styled_components_browser_esm/* default */.ZP)(Components_SocialLinks).withConfig({ componentId: "sc-5a1ba595-5" }).withConfig({ componentId: "sc-821ea00c-5" })(_templateObject5(), colors/* darkColors.cardBorder */._.cardBorder); var StyledText = styled_components_browser_esm/* default.span.withConfig */.ZP.span.withConfig({ componentId: "sc-5a1ba595-6" }).withConfig({ componentId: "sc-821ea00c-6" })(_templateObject6(), colors/* darkColors.text */._.text); // EXTERNAL MODULE: ./packages/uikit/src/components/Dropdown/Dropdown.tsx var Dropdown = __webpack_require__(33560); // EXTERNAL MODULE: ./packages/uikit/src/components/Button/Button.tsx + 2 modules var Button = __webpack_require__(98553); // EXTERNAL MODULE: ./packages/uikit/src/components/Svg/Icons/Language.tsx var Language = __webpack_require__(15446); ;// CONCATENATED MODULE: ./packages/uikit/src/components/LangSelector/MenuButton.tsx function MenuButton_templateObject() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n color: ", ";\n padding: 0 8px;\n border-radius: 8px;\n" ]); MenuButton_templateObject = function _templateObject() { return data; }; return data; } var MenuButton = (0,styled_components_browser_esm/* default */.ZP)(Button/* default */.Z).withConfig({ componentId: "sc-f81265b6-0" }).withConfig({ componentId: "sc-4b8ad6be-0" })(MenuButton_templateObject(), function(param) { var theme = param.theme; return theme.colors.text; }); MenuButton.defaultProps = { variant: "text", size: "sm" }; /* harmony default export */ var LangSelector_MenuButton = (MenuButton); ;// CONCATENATED MODULE: ./packages/uikit/src/components/LangSelector/LangSelector.tsx var LangSelector = function LangSelector(param) { var currentLang = param.currentLang, langs = param.langs, color = param.color, setLang = param.setLang, _dropdownPosition = param.dropdownPosition, dropdownPosition = _dropdownPosition === void 0 ? "bottom" : _dropdownPosition, _buttonScale = param.buttonScale, buttonScale = _buttonScale === void 0 ? "md" : _buttonScale, _hideLanguage = param.hideLanguage, hideLanguage = _hideLanguage === void 0 ? false : _hideLanguage; /*#__PURE__*/ return (0,jsx_runtime.jsx)(Dropdown/* default */.Z, { position: dropdownPosition, target: /*#__PURE__*/ (0,jsx_runtime.jsx)(Button/* default */.Z, { scale: buttonScale, variant: "text", startIcon: /*#__PURE__*/ (0,jsx_runtime.jsx)(Language/* default */.Z, { color: color, width: "24px" }), children: !hideLanguage && /*#__PURE__*/ (0,jsx_runtime.jsx)(Text/* default */.Z, { color: color, children: currentLang === null || currentLang === void 0 ? void 0 : currentLang.toUpperCase() }) }), children: langs.map(function(lang) { return /*#__PURE__*/ (0,jsx_runtime.jsx)(LangSelector_MenuButton, { fullWidth: true, onClick: function onClick() { return setLang(lang); }, // Safari fix style: { minHeight: "32px", height: "auto" }, children: lang.language }, lang.locale); }) }); }; /* harmony default export */ var LangSelector_LangSelector = (/*#__PURE__*/react.memo(LangSelector, function(prev, next) { return prev.currentLang === next.currentLang; })); // EXTERNAL MODULE: ./packages/uikit/src/components/ThemeSwitcher/ThemeSwitcher.tsx var ThemeSwitcher = __webpack_require__(54204); ;// CONCATENATED MODULE: ./packages/uikit/src/components/Footer/Footer.tsx var MenuItem = function MenuItem(_param) { var items = _param.items, isDark = _param.isDark, toggleTheme = _param.toggleTheme, currentLang = _param.currentLang, langs = _param.langs, setLang = _param.setLang, cakePriceUsd = _param.cakePriceUsd, buyCakeLabel = _param.buyCakeLabel, props = (0,_object_without_properties/* default */.Z)(_param, [ "items", "isDark", "toggleTheme", "currentLang", "langs", "setLang", "cakePriceUsd", "buyCakeLabel" ]); return /*#__PURE__*/ (0,jsx_runtime.jsx)(StyledFooter, (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({ p: [ "0px 16px", null, "15px 40px 12px 40px" ] }, props), { justifyContent: "center", children: /*#__PURE__*/ (0,jsx_runtime.jsx)(Flex/* default */.Z, { flexDirection: "column", width: [ "100%", null, "1200px;" ], children: /*#__PURE__*/ (0,jsx_runtime.jsxs)(StyledToolsContainer, (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({}, props), { order: [ 1, null, 3 ], flexDirection: [ "row", null, "row-reverse" ], justifyContent: "space-between", alignItems: "center", style: { gap: "20px" }, children: [ /*#__PURE__*/ (0,jsx_runtime.jsx)(Flex/* default */.Z, { order: [ 2, null, 1 ], alignItems: "center", children: /*#__PURE__*/ (0,jsx_runtime.jsx)(StyledSocialLinks, { pb: [ "0", null, "0" ], mb: [ "0", null, "0" ] }) }), /*#__PURE__*/ (0,jsx_runtime.jsxs)(Flex/* default */.Z, { order: [ 1, null, 1 ], alignItems: "center", children: [ /*#__PURE__*/ (0,jsx_runtime.jsx)(ThemeSwitcher/* default */.Z, { isDark: isDark, toggleTheme: toggleTheme }), /*#__PURE__*/ (0,jsx_runtime.jsx)(LangSelector_LangSelector, { currentLang: currentLang, langs: langs, setLang: setLang, color: "textSubtle", dropdownPosition: "top-right" }) ] }) ] })) }) })); }; /* harmony default export */ var Footer = (MenuItem); // EXTERNAL MODULE: ./packages/uikit/src/util/isTouchDevice.ts var isTouchDevice = __webpack_require__(44047); // EXTERNAL MODULE: ./packages/uikit/src/components/MenuItem/MenuItem.tsx + 1 modules var MenuItem_MenuItem = __webpack_require__(29995); ;// CONCATENATED MODULE: ./packages/uikit/src/components/MenuItems/MenuItems.tsx /* eslint-disable @typescript-eslint/no-explicit-any */ var MenuItems = function MenuItems(_param) { var _items = _param.items, items = _items === void 0 ? [] : _items, activeItem = _param.activeItem, activeSubItem = _param.activeSubItem, props = (0,_object_without_properties/* default */.Z)(_param, [ "items", "activeItem", "activeSubItem" ]); return /*#__PURE__*/ (0,jsx_runtime.jsx)(Flex/* default */.Z, (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({}, props), { children: items.map(function(param) { var label = param.label, tmp = param.items, menuItems = tmp === void 0 ? [] : tmp, href = param.href, icon = param.icon, disabled = param.disabled; var ref, ref1; var statusColor = (ref = menuItems === null || menuItems === void 0 ? void 0 : menuItems.find(function(menuItem) { return menuItem.status !== undefined; })) === null || ref === void 0 ? void 0 : (ref1 = ref.status) === null || ref1 === void 0 ? void 0 : ref1.color; var isActive = activeItem === href; var linkProps = (0,isTouchDevice/* default */.Z)() && menuItems && menuItems.length > 0 ? {} : { href: href }; var Icon = icon; return /*#__PURE__*/ (0,jsx_runtime.jsx)(DropdownMenu_DropdownMenu, { items: menuItems, py: 1, activeItem: activeSubItem, isDisabled: disabled, children: /*#__PURE__*/ (0,jsx_runtime.jsx)(MenuItem_MenuItem/* default */.Z, (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({}, linkProps), { isActive: isActive, statusColor: statusColor, isDisabled: disabled, children: label || icon && /*#__PURE__*/ (0,react.createElement)(Icon, { color: isActive ? "secondary" : "textSubtle" }) })) }, "".concat(label, "#").concat(href)); }) })); }; /* harmony default export */ var MenuItems_MenuItems = (/*#__PURE__*/(0,react.memo)(MenuItems)); // EXTERNAL MODULE: ./packages/uikit/src/components/SubMenuItems/SubMenuItems.tsx + 1 modules var SubMenuItems = __webpack_require__(46852); // EXTERNAL MODULE: ./packages/uikit/src/contexts/MatchBreakpoints/useMatchBreakpoints.ts var useMatchBreakpoints = __webpack_require__(34701); // EXTERNAL MODULE: ./packages/uikit/src/components/CakePrice/CakePrice.tsx var CakePrice = __webpack_require__(70802); // EXTERNAL MODULE: ./packages/uikit/src/widgets/Menu/config.ts var config = __webpack_require__(79544); ;// CONCATENATED MODULE: ./packages/uikit/src/widgets/Menu/Menu.tsx function Menu_templateObject() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n width: 50px;\n" ]); Menu_templateObject = function _templateObject() { return data; }; return data; } function Menu_templateObject1() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n position: relative;\n width: 100%;\n" ]); Menu_templateObject1 = function _templateObject1() { return data; }; return data; } function Menu_templateObject2() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n height: ", "px;\n background-color: ", ";\n border-bottom: 1px solid ", ";\n transform: translate3d(0, 0, 0);\n\n padding-left: 16px;\n padding-right: 16px;\n" ]); Menu_templateObject2 = function _templateObject2() { return data; }; return data; } function Menu_templateObject3() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n position: fixed;\n top: ", ";\n left: 0;\n transition: top 0.2s;\n height: ", ";\n width: 100%;\n z-index: 20;\n" ]); Menu_templateObject3 = function _templateObject3() { return data; }; return data; } function Menu_templateObject4() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n height: ", ";\n min-height: ", ";\n max-height: ", ";\n width: 100%;\n" ]); Menu_templateObject4 = function _templateObject4() { return data; }; return data; } function Menu_templateObject5() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n position: relative;\n display: flex;\n" ]); Menu_templateObject5 = function _templateObject5() { return data; }; return data; } function Menu_templateObject6() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n flex-grow: 1;\n transition: margin-top 0.2s, margin-left 0.2s cubic-bezier(0.4, 0, 0.2, 1);\n transform: translate3d(0, 0, 0);\n max-width: 100%;\n" ]); Menu_templateObject6 = function _templateObject6() { return data; }; return data; } var Logo = (0,styled_components_browser_esm/* default */.ZP)("img").withConfig({ componentId: "sc-f1b6084-0" }).withConfig({ componentId: "sc-8891d7b7-0" })(Menu_templateObject()); var Wrapper = styled_components_browser_esm/* default.div.withConfig */.ZP.div.withConfig({ componentId: "sc-f1b6084-1" }).withConfig({ componentId: "sc-8891d7b7-1" })(Menu_templateObject1()); var StyledNav = styled_components_browser_esm/* default.nav.withConfig */.ZP.nav.withConfig({ componentId: "sc-f1b6084-2" }).withConfig({ componentId: "sc-8891d7b7-2" })(Menu_templateObject2(), config/* MENU_HEIGHT */.d0, function(param) { var theme = param.theme; return theme.nav.background; }, function(param) { var theme = param.theme; return theme.colors.cardBorder; }); var FixedContainer = styled_components_browser_esm/* default.div.withConfig */.ZP.div.withConfig({ componentId: "sc-f1b6084-3" }).withConfig({ componentId: "sc-8891d7b7-3" })(Menu_templateObject3(), function(param) { var showMenu = param.showMenu, height = param.height; return showMenu ? 0 : "-".concat(height, "px"); }, function(param) { var height = param.height; return "".concat(height, "px"); }); var TopBannerContainer = styled_components_browser_esm/* default.div.withConfig */.ZP.div.withConfig({ componentId: "sc-f1b6084-4" }).withConfig({ componentId: "sc-8891d7b7-4" })(Menu_templateObject4(), function(param) { var height = param.height; return "".concat(height, "px"); }, function(param) { var height = param.height; return "".concat(height, "px"); }, function(param) { var height = param.height; return "".concat(height, "px"); }); var BodyWrapper = (0,styled_components_browser_esm/* default */.ZP)(Box/* default */.Z).withConfig({ componentId: "sc-f1b6084-5" }).withConfig({ componentId: "sc-8891d7b7-5" })(Menu_templateObject5()); var Inner = styled_components_browser_esm/* default.div.withConfig */.ZP.div.withConfig({ componentId: "sc-f1b6084-6" }).withConfig({ componentId: "sc-8891d7b7-6" })(Menu_templateObject6()); var Menu = function Menu(param) { var _linkComponent = param.linkComponent, linkComponent = _linkComponent === void 0 ? "a" : _linkComponent, banner = param.banner, rightSide = param.rightSide, isDark = param.isDark, toggleTheme = param.toggleTheme, currentLang = param.currentLang, setLang = param.setLang, cakePriceUsd = param.cakePriceUsd, links = param.links, subLinks = param.subLinks, footerLinks = param.footerLinks, activeItem = param.activeItem, activeSubItem = param.activeSubItem, langs = param.langs, buyCakeLabel = param.buyCakeLabel, children = param.children; var ref = (0,useMatchBreakpoints/* default */.Z)(), isMobile = ref.isMobile, isMd = ref.isMd; var ref1 = (0,react.useState)(true), showMenu = ref1[0], setShowMenu = ref1[1]; var refPrevOffset = (0,react.useRef)( false ? 0 : window.pageYOffset); var topBannerHeight = isMobile ? config/* TOP_BANNER_HEIGHT_MOBILE */.Mf : config/* TOP_BANNER_HEIGHT */.pZ; var totalTopMenuHeight = banner ? config/* MENU_HEIGHT */.d0 + topBannerHeight : config/* MENU_HEIGHT */.d0; (0,react.useEffect)(function() { var handleScroll = function handleScroll() { var currentOffset = window.pageYOffset; var isBottomOfPage = window.document.body.clientHeight === currentOffset + window.innerHeight; var isTopOfPage = currentOffset === 0; // Always show the menu when user reach the top if (isTopOfPage) { setShowMenu(true); } else if (!isBottomOfPage) { if (currentOffset < refPrevOffset.current || currentOffset <= totalTopMenuHeight) { // Has scroll up setShowMenu(true); } else { // Has scroll down setShowMenu(false); } } refPrevOffset.current = currentOffset; }; var throttledHandleScroll = throttle_default()(handleScroll, 200); window.addEventListener("scroll", throttledHandleScroll); return function() { window.removeEventListener("scroll", throttledHandleScroll); }; }, [ totalTopMenuHeight ]); // Find the home link if provided var homeLink = links.find(function(link) { return link.label === "Home"; }); var subLinksWithoutMobile = subLinks === null || subLinks === void 0 ? void 0 : subLinks.filter(function(subLink) { return !subLink.isMobileOnly; }); var subLinksMobileOnly = subLinks === null || subLinks === void 0 ? void 0 : subLinks.filter(function(subLink) { return subLink.isMobileOnly; }); return /*#__PURE__*/ (0,jsx_runtime.jsx)(context/* MenuContext.Provider */.p.Provider, { value: { linkComponent: linkComponent }, children: /*#__PURE__*/ (0,jsx_runtime.jsxs)(Wrapper, { children: [ /*#__PURE__*/ (0,jsx_runtime.jsxs)(FixedContainer, { showMenu: showMenu, height: totalTopMenuHeight, children: [ banner && /*#__PURE__*/ (0,jsx_runtime.jsx)(TopBannerContainer, { height: topBannerHeight, children: banner }), /*#__PURE__*/ (0,jsx_runtime.jsxs)(StyledNav, { children: [ /*#__PURE__*/ (0,jsx_runtime.jsxs)(Flex/* default */.Z, { children: [ /*#__PURE__*/ (0,jsx_runtime.jsx)(Logo, { src: "/images/tokens/0x679f6863a653251C8C215e77205A7058b5bF676a.png" }), !isMobile && /*#__PURE__*/ (0,jsx_runtime.jsx)(MenuItems_MenuItems, { items: links, activeItem: activeItem, activeSubItem: activeSubItem, ml: "24px" }) ] }), /*#__PURE__*/ (0,jsx_runtime.jsxs)(Flex/* default */.Z, { alignItems: "center", height: "100%", children: [ !isMobile && !isMd && /*#__PURE__*/ (0,jsx_runtime.jsx)(Box/* default */.Z, { mr: "12px", children: /*#__PURE__*/ (0,jsx_runtime.jsx)(CakePrice/* default */.Z, { showSkeleton: false, cakePriceUsd: cakePriceUsd }) }), /*#__PURE__*/ (0,jsx_runtime.jsx)(Box/* default */.Z, { mt: "4px", children: /*#__PURE__*/ (0,jsx_runtime.jsx)(LangSelector_LangSelector, { currentLang: currentLang, langs: langs, setLang: setLang, buttonScale: "xs", color: "textSubtle", hideLanguage: true }) }), rightSide ] }) ] }) ] }), subLinks && /*#__PURE__*/ (0,jsx_runtime.jsxs)(Flex/* default */.Z, { justifyContent: "space-around", children: [ /*#__PURE__*/ (0,jsx_runtime.jsx)(SubMenuItems/* default */.Z, { items: subLinksWithoutMobile, mt: "".concat(totalTopMenuHeight + 1, "px"), activeItem: activeSubItem }), (subLinksMobileOnly === null || subLinksMobileOnly === void 0 ? void 0 : subLinksMobileOnly.length) > 0 && /*#__PURE__*/ (0,jsx_runtime.jsx)(SubMenuItems/* default */.Z, { items: subLinksMobileOnly, mt: "".concat(totalTopMenuHeight + 1, "px"), activeItem: activeSubItem, isMobileOnly: true }) ] }), /*#__PURE__*/ (0,jsx_runtime.jsx)(BodyWrapper, { mt: !subLinks ? "".concat(totalTopMenuHeight + 1, "px") : "0", children: /*#__PURE__*/ (0,jsx_runtime.jsxs)(Inner, { isPushed: false, showMenu: showMenu, children: [ children, /*#__PURE__*/ (0,jsx_runtime.jsx)(Footer, { items: footerLinks, isDark: isDark, toggleTheme: toggleTheme, langs: langs, setLang: setLang, currentLang: currentLang, cakePriceUsd: cakePriceUsd, buyCakeLabel: buyCakeLabel, mb: [ "".concat(config/* MOBILE_MENU_HEIGHT */.GR, "px"), null, "0px" ] }) ] }) }), isMobile && /*#__PURE__*/ (0,jsx_runtime.jsx)(BottomNav_BottomNav, { items: links, activeItem: activeItem, activeSubItem: activeSubItem }) ] }) }); }; /* harmony default export */ var Menu_Menu = (Menu); /***/ }), /***/ 62877: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { "ZP": function() { return /* binding */ components_UserMenu; } }); // UNUSED EXPORTS: LabelText, StyledUserMenu // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_spread.mjs var _object_spread = __webpack_require__(26042); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_spread_props.mjs var _object_spread_props = __webpack_require__(69396); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_without_properties.mjs + 1 modules var _object_without_properties = __webpack_require__(99534); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_tagged_template_literal.mjs var _tagged_template_literal = __webpack_require__(7297); // EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js var jsx_runtime = __webpack_require__(85893); // EXTERNAL MODULE: ./node_modules/react/index.js var react = __webpack_require__(67294); // EXTERNAL MODULE: ./node_modules/react-popper/lib/esm/usePopper.js + 53 modules var usePopper = __webpack_require__(66441); // EXTERNAL MODULE: ./node_modules/styled-components/dist/styled-components.browser.esm.js + 4 modules var styled_components_browser_esm = __webpack_require__(87379); // EXTERNAL MODULE: ./packages/uikit/src/components/Box/Flex.tsx var Flex = __webpack_require__(75943); // EXTERNAL MODULE: ./packages/uikit/src/components/Box/Box.tsx var Box = __webpack_require__(44147); // EXTERNAL MODULE: ./packages/uikit/src/components/Svg/Icons/ChevronDown.tsx var ChevronDown = __webpack_require__(57049); ;// CONCATENATED MODULE: ./packages/uikit/src/widgets/Menu/components/UserMenu/types.ts var variants = { DEFAULT: "default", WARNING: "warning", DANGER: "danger", PENDING: "pending" }; // EXTERNAL MODULE: ./packages/uikit/src/components/Image/Image.tsx var Image = __webpack_require__(63970); // EXTERNAL MODULE: ./packages/uikit/src/components/Svg/Icons/WalletFilled.tsx var WalletFilled = __webpack_require__(82466); // EXTERNAL MODULE: ./packages/uikit/src/components/Svg/Icons/Refresh.tsx var Refresh = __webpack_require__(39054); // EXTERNAL MODULE: ./packages/uikit/src/components/Svg/Icons/Warning.tsx var Warning = __webpack_require__(93617); ;// CONCATENATED MODULE: ./packages/uikit/src/widgets/Menu/components/UserMenu/MenuIcon.tsx function _templateObject() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n align-items: center;\n background-color: ", ";\n border-color: ", ";\n border-radius: 50%;\n border-style: solid;\n border-width: 2px;\n display: flex;\n height: 32px;\n justify-content: center;\n left: 0;\n position: absolute;\n top: 0;\n width: 32px;\n z-index: 102;\n" ]); _templateObject = function _templateObject() { return data; }; return data; } function _templateObject1() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n left: 0;\n position: absolute;\n top: 0;\n z-index: 102;\n\n & > img {\n border-radius: 50%;\n }\n" ]); _templateObject1 = function _templateObject1() { return data; }; return data; } var MenuIconWrapper = styled_components_browser_esm/* default.div.withConfig */.ZP.div.withConfig({ componentId: "sc-e5a41a22-0" }).withConfig({ componentId: "sc-eb16876f-0" })(_templateObject(), function(param) { var theme = param.theme; return theme.colors.background; }, function(param) { var theme = param.theme, borderColor = param.borderColor; return theme.colors[borderColor]; }); var ProfileIcon = (0,styled_components_browser_esm/* default */.ZP)(Image/* default */.Z).withConfig({ componentId: "sc-e5a41a22-1" }).withConfig({ componentId: "sc-eb16876f-1" })(_templateObject1()); var NoProfileMenuIcon = function NoProfileMenuIcon() { return /*#__PURE__*/ (0,jsx_runtime.jsx)(MenuIconWrapper, { borderColor: "primary", children: /*#__PURE__*/ (0,jsx_runtime.jsx)(WalletFilled/* default */.Z, { color: "primary", width: "24px" }) }); }; var PendingMenuIcon = function PendingMenuIcon() { return /*#__PURE__*/ (0,jsx_runtime.jsx)(MenuIconWrapper, { borderColor: "secondary", children: /*#__PURE__*/ (0,jsx_runtime.jsx)(Refresh/* default */.Z, { color: "secondary", width: "24px", spin: true }) }); }; var WarningMenuIcon = function WarningMenuIcon() { return /*#__PURE__*/ (0,jsx_runtime.jsx)(MenuIconWrapper, { borderColor: "warning", children: /*#__PURE__*/ (0,jsx_runtime.jsx)(Warning/* default */.Z, { color: "warning", width: "24px" }) }); }; var DangerMenuIcon = function DangerMenuIcon() { return /*#__PURE__*/ (0,jsx_runtime.jsx)(MenuIconWrapper, { borderColor: "failure", children: /*#__PURE__*/ (0,jsx_runtime.jsx)(Warning/* default */.Z, { color: "failure", width: "24px" }) }); }; var MenuIcon = function MenuIcon(param) { var avatarSrc = param.avatarSrc, variant = param.variant; if (variant === variants.DANGER) { return /*#__PURE__*/ (0,jsx_runtime.jsx)(DangerMenuIcon, {}); } if (variant === variants.WARNING) { return /*#__PURE__*/ (0,jsx_runtime.jsx)(WarningMenuIcon, {}); } if (variant === variants.PENDING) { return /*#__PURE__*/ (0,jsx_runtime.jsx)(PendingMenuIcon, {}); } if (!avatarSrc) { return /*#__PURE__*/ (0,jsx_runtime.jsx)(NoProfileMenuIcon, {}); } return /*#__PURE__*/ (0,jsx_runtime.jsx)(ProfileIcon, { src: avatarSrc, height: 32, width: 32 }); }; /* harmony default export */ var UserMenu_MenuIcon = (MenuIcon); // EXTERNAL MODULE: ./packages/uikit/src/widgets/Menu/components/UserMenu/styles.tsx var styles = __webpack_require__(8374); ;// CONCATENATED MODULE: ./packages/uikit/src/widgets/Menu/components/UserMenu/index.tsx function UserMenu_templateObject() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n align-items: center;\n background-color: ", ";\n border-radius: 16px;\n box-shadow: inset 0px -2px 0px rgba(0, 0, 0, 0.1);\n cursor: pointer;\n display: inline-flex;\n height: 32px;\n padding-left: 32px;\n padding-right: 8px;\n position: relative;\n\n &:hover {\n opacity: 0.65;\n }\n" ]); UserMenu_templateObject = function _templateObject() { return data; }; return data; } function UserMenu_templateObject1() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n color: ", ";\n display: none;\n font-weight: 600;\n\n ", " {\n display: block;\n margin-left: 8px;\n margin-right: 4px;\n }\n" ]); UserMenu_templateObject1 = function _templateObject1() { return data; }; return data; } function _templateObject2() { var data = (0,_tagged_template_literal/* default */.Z)([ "\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: 16px;\n padding-bottom: 4px;\n padding-top: 4px;\n pointer-events: auto;\n width: 280px;\n visibility: visible;\n z-index: 1001;\n\n ", "\n\n ", ":first-child {\n border-radius: 8px 8px 0 0;\n }\n\n ", ":last-child {\n border-radius: 0 0 8px 8px;\n }\n" ]); _templateObject2 = function _templateObject2() { return data; }; return data; } var StyledUserMenu = (0,styled_components_browser_esm/* default */.ZP)(Flex/* default */.Z).withConfig({ componentId: "sc-9ad39da0-0" }).withConfig({ componentId: "sc-609e5ec2-0" })(UserMenu_templateObject(), function(param) { var theme = param.theme; return theme.colors.tertiary; }); var LabelText = styled_components_browser_esm/* default.div.withConfig */.ZP.div.withConfig({ componentId: "sc-9ad39da0-1" }).withConfig({ componentId: "sc-609e5ec2-1" })(UserMenu_templateObject1(), function(param) { var theme = param.theme; return theme.colors.text; }, function(param) { var theme = param.theme; return theme.mediaQueries.sm; }); var Menu = styled_components_browser_esm/* default.div.withConfig */.ZP.div.withConfig({ componentId: "sc-9ad39da0-2" }).withConfig({ componentId: "sc-609e5ec2-2" })(_templateObject2(), function(param) { var theme = param.theme; return theme.card.background; }, function(param) { var theme = param.theme; return theme.colors.cardBorder; }, function(param) { var isOpen = param.isOpen; return !isOpen && "\n pointer-events: none;\n visibility: hidden;\n "; }, styles/* UserMenuItem */.l, styles/* UserMenuItem */.l); var UserMenu = function UserMenu(_param) { var account = _param.account, text = _param.text, avatarSrc = _param.avatarSrc, _variant = _param.variant, variant = _variant === void 0 ? variants.DEFAULT : _variant, children = _param.children, disabled = _param.disabled, props = (0,_object_without_properties/* default */.Z)(_param, [ "account", "text", "avatarSrc", "variant", "children", "disabled" ]); var ref = (0,react.useState)(false), isOpen = ref[0], setIsOpen = ref[1]; var ref1 = (0,react.useState)(null), targetRef = ref1[0], setTargetRef = ref1[1]; var ref2 = (0,react.useState)(null), tooltipRef = ref2[0], setTooltipRef = ref2[1]; var accountEllipsis = account ? "".concat(account.substring(0, 2), "...").concat(account.substring(account.length - 4)) : null; var ref3 = (0,usePopper/* usePopper */.D)(targetRef, tooltipRef, { strategy: "fixed", placement: "bottom-end", modifiers: [ { name: "offset", options: { offset: [ 0, 0 ] } } ] }), styles = ref3.styles, attributes = ref3.attributes; (0,react.useEffect)(function() { var showDropdownMenu = function showDropdownMenu() { setIsOpen(true); }; var hideDropdownMenu = function hideDropdownMenu(evt) { var target = evt.target; if (target && !(tooltipRef === null || tooltipRef === void 0 ? void 0 : tooltipRef.contains(target))) { setIsOpen(false); evt.stopPropagation(); } }; targetRef === null || targetRef === void 0 ? void 0 : targetRef.addEventListener("mouseenter", showDropdownMenu); targetRef === null || targetRef === void 0 ? void 0 : targetRef.addEventListener("mouseleave", hideDropdownMenu); return function() { targetRef === null || targetRef === void 0 ? void 0 : targetRef.removeEventListener("mouseenter", showDropdownMenu); targetRef === null || targetRef === void 0 ? void 0 : targetRef.removeEventListener("mouseleave", hideDropdownMenu); }; }, [ targetRef, tooltipRef, setIsOpen ]); return /*#__PURE__*/ (0,jsx_runtime.jsxs)(Flex/* default */.Z, (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({ alignItems: "center", height: "100%", ref: setTargetRef }, props), { children: [ /*#__PURE__*/ (0,jsx_runtime.jsxs)(StyledUserMenu, { onTouchStart: function onTouchStart() { setIsOpen(function(s) { return !s; }); }, children: [ /*#__PURE__*/ (0,jsx_runtime.jsx)(UserMenu_MenuIcon, { avatarSrc: avatarSrc, variant: variant }), /*#__PURE__*/ (0,jsx_runtime.jsx)(LabelText, { title: typeof text === "string" ? text || account : account, children: text || accountEllipsis }), !disabled && /*#__PURE__*/ (0,jsx_runtime.jsx)(ChevronDown/* default */.Z, { color: "text", width: "24px" }) ] }), !disabled && /*#__PURE__*/ (0,jsx_runtime.jsx)(Menu, (0,_object_spread_props/* default */.Z)((0,_object_spread/* default */.Z)({ style: styles.popper, ref: setTooltipRef }, attributes.popper), { isOpen: isOpen, children: /*#__PURE__*/ (0,jsx_runtime.jsx)(Box/* default */.Z, { onClick: function onClick() { return setIsOpen(false); }, children: children === null || children === void 0 ? void 0 : children({ isOpen: isOpen }) }) })) ] })); }; /* harmony default export */ var components_UserMenu = (UserMenu); /***/ }), /***/ 8374: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "l": function() { return /* binding */ UserMenuItem; }, /* harmony export */ "v": function() { return /* binding */ UserMenuDivider; } /* harmony export */ }); /* harmony import */ var _swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7297); /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(87379); function _templateObject() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n border-color: ", ";\n border-style: solid;\n border-width: 1px 0 0;\n margin: 4px 0;\n" ]); _templateObject = function _templateObject() { return data; }; return data; } function _templateObject1() { var data = (0,_swc_helpers_src_tagged_template_literal_mjs__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)([ "\n align-items: center;\n border: 0;\n background: transparent;\n color: ", ";\n cursor: pointer;\n display: flex;\n font-size: 16px;\n height: 48px;\n justify-content: space-between;\n outline: 0;\n padding-left: 16px;\n padding-right: 16px;\n width: 100%;\n\n &:is(button) {\n cursor: ", ";\n }\n\n &:hover:not(:disabled) {\n background-color: ", ";\n }\n\n &:active:not(:disabled) {\n opacity: 0.85;\n transform: translateY(1px);\n }\n" ]); _templateObject1 = function _templateObject1() { return data; }; return data; } var UserMenuDivider = styled_components__WEBPACK_IMPORTED_MODULE_1__/* ["default"].hr.withConfig */ .ZP.hr.withConfig({ componentId: "sc-41c17261-0" }).withConfig({ componentId: "sc-d6870169-0" })(_templateObject(), function(param) { var theme = param.theme; return theme.colors.cardBorder; }); var UserMenuItem = styled_components__WEBPACK_IMPORTED_MODULE_1__/* ["default"].button.withConfig */ .ZP.button.withConfig({ componentId: "sc-41c17261-1" }).withConfig({ componentId: "sc-d6870169-1" })(_templateObject1(), function(param) { var theme = param.theme, disabled = param.disabled; return theme.colors[disabled ? "textDisabled" : "textSubtle"]; }, function(param) { var disabled = param.disabled; return disabled ? "not-allowed" : "pointer"; }, function(param) { var theme = param.theme; return theme.colors.tertiary; }); /***/ }), /***/ 79544: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "GR": function() { return /* binding */ MOBILE_MENU_HEIGHT; }, /* harmony export */ "Mf": function() { return /* binding */ TOP_BANNER_HEIGHT_MOBILE; }, /* harmony export */ "Ok": function() { return /* binding */ links; }, /* harmony export */ "d0": function() { return /* binding */ MENU_HEIGHT; }, /* harmony export */ "i7": function() { return /* binding */ status; }, /* harmony export */ "pZ": function() { return /* binding */ TOP_BANNER_HEIGHT; } /* harmony export */ }); /* unused harmony exports userMenulinks, MENU_ENTRY_HEIGHT, SIDEBAR_WIDTH_FULL, SIDEBAR_WIDTH_REDUCED */ /* harmony import */ var lodash_noop__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(50308); /* harmony import */ var lodash_noop__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_noop__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _components_DropdownMenu_types__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(78242); /* harmony import */ var _components_Svg__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(47811); /* harmony import */ var _components_Svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(14481); /* harmony import */ var _components_Svg__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(51959); /* harmony import */ var _components_Svg__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(41655); /* harmony import */ var _components_Svg__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(24985); /* harmony import */ var _components_Svg__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(76306); /* harmony import */ var _components_Svg__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(50081); var status = { LIVE: { text: "LIVE", color: "failure" }, SOON: { text: "SOON", color: "warning" }, NEW: { text: "NEW", color: "success" } }; var links = [ { label: "Trade", href: "/swap", icon: _components_Svg__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z, fillIcon: _components_Svg__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, items: [ { label: "Exchange", href: "/swap" }, { label: "Liquidity", href: "/liquidity" }, { label: "Charts", href: "/charts", iconName: "Chart", isMobileOnly: true }, ] }, { label: "Earn", href: "/earn", icon: _components_Svg__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z, fillIcon: _components_Svg__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, items: [ { label: "Earn", href: "/earn" }, { label: "Yield Farms", href: "/farms" }, { label: "Syrup pools", href: "/pools" }, ] }, { label: "Win", href: "/", icon: _components_Svg__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, fillIcon: _components_Svg__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, items: [ { label: "Win", href: "/" }, { label: "Predictions", href: "/", status: status.LIVE }, { label: "Lottery", href: "/" }, ] }, { label: "", href: "/", icon: _components_Svg__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z, items: [ { label: "Info & Analytics", href: "/" }, { label: "IFO Token Sales", href: "/", status: status.SOON }, { type: _components_DropdownMenu_types__WEBPACK_IMPORTED_MODULE_8__/* .DropdownMenuItemType.DIVIDER */ .l.DIVIDER }, { label: "NFT Collectibles", href: "/" }, { label: "Team Leaderboard", href: "/" }, { type: _components_DropdownMenu_types__WEBPACK_IMPORTED_MODULE_8__/* .DropdownMenuItemType.DIVIDER */ .l.DIVIDER }, { label: "Blog", href: "/" }, { label: "Docs & Guides", href: "/", type: _components_DropdownMenu_types__WEBPACK_IMPORTED_MODULE_8__/* .DropdownMenuItemType.EXTERNAL_LINK */ .l.EXTERNAL_LINK }, ] }, ]; var userMenulinks = [ { label: "Wallet", onClick: (lodash_noop__WEBPACK_IMPORTED_MODULE_0___default()), type: _components_DropdownMenu_types__WEBPACK_IMPORTED_MODULE_8__/* .DropdownMenuItemType.BUTTON */ .l.BUTTON }, { label: "Transactions", type: _components_DropdownMenu_types__WEBPACK_IMPORTED_MODULE_8__/* .DropdownMenuItemType.BUTTON */ .l.BUTTON }, { type: _components_DropdownMenu_types__WEBPACK_IMPORTED_MODULE_8__/* .DropdownMenuItemType.DIVIDER */ .l.DIVIDER }, { type: _components_DropdownMenu_types__WEBPACK_IMPORTED_MODULE_8__/* .DropdownMenuItemType.BUTTON */ .l.BUTTON, disabled: true, label: "Dashboard" }, { type: _components_DropdownMenu_types__WEBPACK_IMPORTED_MODULE_8__/* .DropdownMenuItemType.BUTTON */ .l.BUTTON, disabled: true, label: "Portfolio" }, { label: "Profile", href: "/profile" }, { type: _components_DropdownMenu_types__WEBPACK_IMPORTED_MODULE_8__/* .DropdownMenuItemType.EXTERNAL_LINK */ .l.EXTERNAL_LINK, href: "https://pancakeswap.finance", label: "Link" }, { type: _components_DropdownMenu_types__WEBPACK_IMPORTED_MODULE_8__/* .DropdownMenuItemType.DIVIDER */ .l.DIVIDER }, { type: _components_DropdownMenu_types__WEBPACK_IMPORTED_MODULE_8__/* .DropdownMenuItemType.BUTTON */ .l.BUTTON, onClick: (lodash_noop__WEBPACK_IMPORTED_MODULE_0___default()), label: "Disconnect" }, ]; var MENU_HEIGHT = 56; var MENU_ENTRY_HEIGHT = 48; var MOBILE_MENU_HEIGHT = 44; var SIDEBAR_WIDTH_FULL = 240; var SIDEBAR_WIDTH_REDUCED = 56; var TOP_BANNER_HEIGHT = 70; var TOP_BANNER_HEIGHT_MOBILE = 84; /***/ }), /***/ 63524: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "p": function() { return /* binding */ MenuContext; } /* harmony export */ }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(67294); var MenuContext = (0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)({ linkComponent: "a" }); /***/ }), /***/ 2236: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "R": function() { return /* binding */ light; }, /* harmony export */ "_": function() { return /* binding */ dark; } /* harmony export */ }); /* harmony import */ var _theme_colors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16557); var light = { background: _theme_colors__WEBPACK_IMPORTED_MODULE_0__/* .lightColors.backgroundAlt */ .C.backgroundAlt }; var dark = { background: _theme_colors__WEBPACK_IMPORTED_MODULE_0__/* .darkColors.backgroundAlt */ ._.backgroundAlt }; /***/ }), /***/ 85937: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "d": function() { return /* binding */ MODAL_SWIPE_TO_CLOSE_VELOCITY; } /* harmony export */ }); /* harmony import */ var _swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(26042); /* harmony import */ var _swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(69396); /* harmony import */ var _swc_helpers_src_object_without_properties_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(99534); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(85893); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67294); /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(87379); /* harmony import */ var _components_Heading_Heading__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(69589); /* harmony import */ var _util_getThemeValue__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(1983); /* harmony import */ var _styles__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(15426); /* harmony import */ var _contexts__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(34701); var MODAL_SWIPE_TO_CLOSE_VELOCITY = 300; var Modal = function Modal(_param) { var title = _param.title, onDismiss = _param.onDismiss, onBack = _param.onBack, children = _param.children, _hideCloseButton = _param.hideCloseButton, hideCloseButton = _hideCloseButton === void 0 ? false : _hideCloseButton, _bodyPadding = _param.bodyPadding, bodyPadding = _bodyPadding === void 0 ? "24px" : _bodyPadding, _headerBackground = _param.headerBackground, headerBackground = _headerBackground === void 0 ? "transparent" : _headerBackground, _minWidth = _param.minWidth, minWidth = _minWidth === void 0 ? "320px" : _minWidth, props = (0,_swc_helpers_src_object_without_properties_mjs__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)(_param, [ "title", "onDismiss", "onBack", "children", "hideCloseButton", "bodyPadding", "headerBackground", "minWidth" ]); var theme = (0,styled_components__WEBPACK_IMPORTED_MODULE_3__/* .useTheme */ .Fg)(); var isMobile = (0,_contexts__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)().isMobile; var wrapperRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null); return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_styles__WEBPACK_IMPORTED_MODULE_5__/* .ModalContainer */ .F0, (0,_swc_helpers_src_object_spread_props_mjs__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z)((0,_swc_helpers_src_object_spread_mjs__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z)({ drag: isMobile ? "y" : false, dragConstraints: { top: 0, bottom: 600 }, dragElastic: { top: 0 }, dragSnapToOrigin: true, onDragStart: function onDragStart() { if (wrapperRef.current) wrapperRef.current.style.animation = "none"; }, onDragEnd: function onDragEnd(e, info) { if (info.velocity.y > MODAL_SWIPE_TO_CLOSE_VELOCITY && onDismiss) onDismiss(); }, ref: wrapperRef, $minWidth: minWidth }, props), { children: [ /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_styles__WEBPACK_IMPORTED_MODULE_5__/* .ModalHeader */ .xB, { background: (0,_util_getThemeValue__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z)(theme, "colors.".concat(headerBackground), headerBackground), children: [ /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_styles__WEBPACK_IMPORTED_MODULE_5__/* .ModalTitle */ .r6, { children: [ onBack && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_styles__WEBPACK_IMPORTED_MODULE_5__/* .ModalBackButton */ .vy, { onBack: onBack }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_Heading_Heading__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z, { children: title }) ] }), !hideCloseButton && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_styles__WEBPACK_IMPORTED_MODULE_5__/* .ModalCloseButton */ .ol, { onDismiss: onDismiss }) ] }), /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_styles__WEBPACK_IMPORTED_MODULE_5__/* .ModalBody */ .fe, { p: bodyPadding, children: children }) ] })); }; /* harmony default export */ __webpack_exports__["Z"] = (Modal); /***/ }), /***/ 25325: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { "_": function() { return /* binding */ Context; }, "Z": function() { return /* binding */ ModalContext; } }); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_spread.mjs var _object_spread = __webpack_require__(26042); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_object_spread_props.mjs var _object_spread_props = __webpack_require__(69396); // EXTERNAL MODULE: ./node_modules/@swc/helpers/src/_tagged_template_literal.mjs var _tagged_template_literal = __webpack_require__(7297); // EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js var jsx_runtime = __webpack_require__(85893); // EXTERNAL MODULE: ./node_modules/framer-motion/dist/es/render/dom/motion-minimal.mjs + 23 modules var motion_minimal = __webpack_require__(45962); // EXTERNAL MODULE: ./node_modules/framer-motion/dist/es/components/LazyMotion/index.mjs var LazyMotion = __webpack_require__(18522); // EXTERNAL MODULE: ./node_modules/tslib/tslib.es6.js var tslib_es6 = __webpack_require__(70655); // EXTERNAL MODULE: ./node_modules/react/index.js var react = __webpack_require__(67294); // EXTERNAL MODULE: ./node_modules/hey-listen/dist/hey-listen.es.js var hey_listen_es = __webpack_require__(24394); // EXTERNAL MODULE: ./node_modules/framer-motion/dist/es/gestures/utils/event-type.mjs var event_type = __webpack_require__(60900); // EXTERNAL MODULE: ./node_modules/framer-motion/dist/es/events/event-info.mjs var event_info = __webpack_require__(28148); // EXTERNAL MODULE: ./node_modules/framesync/dist/es/index.mjs + 2 modules var es = __webpack_require__(54735); // EXTERNAL MODULE: ./node_modules/framer-motion/dist/es/utils/time-conversion.mjs var time_conversion = __webpack_require__(86917); // EXTERNAL MODULE: ./node_modules/framer-motion/dist/es/events/use-pointer-event.mjs + 1 modules var use_pointer_event = __webpack_require__(70737); ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/is-point.mjs const isPoint = (point) => point.hasOwnProperty('x') && point.hasOwnProperty('y'); ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/is-point-3d.mjs const isPoint3D = (point) => isPoint(point) && point.hasOwnProperty('z'); // EXTERNAL MODULE: ./node_modules/popmotion/dist/es/utils/inc.mjs var inc = __webpack_require__(80734); ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/distance.mjs const distance1D = (a, b) => Math.abs(a - b); function distance(a, b) { if ((0,inc/* isNum */.e)(a) && (0,inc/* isNum */.e)(b)) { return distance1D(a, b); } else if (isPoint(a) && isPoint(b)) { const xDelta = distance1D(a.x, b.x); const yDelta = distance1D(a.y, b.y); const zDelta = isPoint3D(a) && isPoint3D(b) ? distance1D(a.z, b.z) : 0; return Math.sqrt(Math.pow(xDelta, 2) + Math.pow(yDelta, 2) + Math.pow(zDelta, 2)); } } // EXTERNAL MODULE: ./node_modules/popmotion/dist/es/utils/pipe.mjs var pipe = __webpack_require__(9897); ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/PanSession.mjs /** * @internal */ var PanSession = /** @class */ (function () { function PanSession(event, handlers, _a) { var _this = this; var _b = _a === void 0 ? {} : _a, transformPagePoint = _b.transformPagePoint; /** * @internal */ this.startEvent = null; /** * @internal */ this.lastMoveEvent = null; /** * @internal */ this.lastMoveEventInfo = null; /** * @internal */ this.handlers = {}; this.updatePoint = function () { if (!(_this.lastMoveEvent && _this.lastMoveEventInfo)) return; var info = getPanInfo(_this.lastMoveEventInfo, _this.history); var isPanStarted = _this.startEvent !== null; // Only start panning if the offset is larger than 3 pixels. If we make it // any larger than this we'll want to reset the pointer history // on the first update to avoid visual snapping to the cursoe. var isDistancePastThreshold = distance(info.offset, { x: 0, y: 0 }) >= 3; if (!isPanStarted && !isDistancePastThreshold) return; var point = info.point; var timestamp = (0,es/* getFrameData */.$B)().timestamp; _this.history.push((0,tslib_es6.__assign)((0,tslib_es6.__assign)({}, point), { timestamp: timestamp })); var _a = _this.handlers, onStart = _a.onStart, onMove = _a.onMove; if (!isPanStarted) { onStart && onStart(_this.lastMoveEvent, info); _this.startEvent = _this.lastMoveEvent; } onMove && onMove(_this.lastMoveEvent, info); }; this.handlePointerMove = function (event, info) { _this.lastMoveEvent = event; _this.lastMoveEventInfo = transformPoint(info, _this.transformPagePoint); // Because Safari doesn't trigger mouseup events when it's above a `